git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: How to restore changes to the remote master branch to its previous stage ?

From
Johannes Sixt <j6t@kdbg.org>
Date
Jun 7, 2014, 07:18 UTC
Message-ID
<5392BCD6.9070603@kdbg.org>
In-Reply-To
<1409256.vCu7BMQsbW@linux-wzza.site>
Am 07.06.2014 08:07, schrieb Arup Rakshit:
Show 13 quoted lines
> Hi,
> 
> I am working in a project, where I am using *Git*. Today, I have been advised  
> by my manager to do some change and it was an urgent request. I did the change 
> and tested also, All was working fine. The big mistake I did, all the changes I 
> made in the *master* branch without creating a topic a branch. So, once I done 
> with the changes I did *git push origin master* and the changed got merged to 
> *master* branch of the remote repository. I know this is not a good practice, 
> all happened accidentally. 
> 
> Now my question is in such a case, if I see, something wrong I pushed and 
> merged to the remote repo's *master* branch, how to restore it to its previous 
> stage using *git* ? 

Assuming that the remote master branch is tracked in your local repository, the following should do it:

  git push origin origin/master@{1}:master

The plus forces a non-fast-forward push. See 'man gitrevisions' about the foo@{1} syntax before you run the command.

-- Hannes
Previous: Arup Rakshit
Message 2 of 2 in “How to restore changes to the remote master branch to its previous stage ?”
  1. Arup RakshitJun 7, 2014
  2. Johannes SixtJun 7, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.