git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to restore changes to the remote master branch to its previous stage ?
@ 2014-06-07  6:07 Arup Rakshit
  2014-06-07  7:18 ` Johannes Sixt
  0 siblings, 1 reply; 2+ messages in thread
From: Arup Rakshit @ 2014-06-07  6:07 UTC (permalink / raw)
  To: git

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* ? 

- 
================
Regards,
Arup Rakshit
================
Debugging is twice as hard as writing the code in the first place. Therefore, 
if you write the code as cleverly as possible, you are, by definition, not 
smart enough to debug it.

--Brian Kernighan

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to restore changes to the remote master branch to its previous stage ?
  2014-06-07  6:07 How to restore changes to the remote master branch to its previous stage ? Arup Rakshit
@ 2014-06-07  7:18 ` Johannes Sixt
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Sixt @ 2014-06-07  7:18 UTC (permalink / raw)
  To: Arup Rakshit, git

Am 07.06.2014 08:07, schrieb Arup Rakshit:
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-07  7:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-07  6:07 How to restore changes to the remote master branch to its previous stage ? Arup Rakshit
2014-06-07  7:18 ` Johannes Sixt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).