{"thread":{"id":"36867","subject":"How to restore changes to the remote master branch to its previous stage ?","startedAt":"2014-06-07T06:07:11Z","lastAt":"2014-06-07T07:18:46Z","messageCount":2,"participants":["Arup Rakshit","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"243582","messageId":"1409256.vCu7BMQsbW@linux-wzza.site","threadId":"36867","inReplyTo":null,"subject":"How to restore changes to the remote master branch to its previous stage ?","fromName":"Arup Rakshit","fromEmail":"aruprakshit@rocketmail.com","sentAt":"2014-06-07T06:07:11Z","receivedAt":"2014-06-07T06:07:11Z","isPatch":false,"sender":{"key":"aruprakshit@rocketmail.com","avatar":"https://gravatar.com/avatar/a05a6142b0941fafb88c96b156982deb8e49e863ae7803d15c5147276fdeff92?d=mp&s=160"},"body":"Hi,\n\nI am working in a project, where I am using *Git*. Today, I have been advised  \nby my manager to do some change and it was an urgent request. I did the change \nand tested also, All was working fine. The big mistake I did, all the changes I \nmade in the *master* branch without creating a topic a branch. So, once I done \nwith the changes I did *git push origin master* and the changed got merged to \n*master* branch of the remote repository. I know this is not a good practice, \nall happened accidentally. \n\nNow my question is in such a case, if I see, something wrong I pushed and \nmerged to the remote repo's *master* branch, how to restore it to its previous \nstage using *git* ? \n\n- \n================\nRegards,\nArup Rakshit\n================\nDebugging is twice as hard as writing the code in the first place. Therefore, \nif you write the code as cleverly as possible, you are, by definition, not \nsmart enough to debug it.\n\n--Brian Kernighan\n"},{"id":"243584","messageId":"5392BCD6.9070603@kdbg.org","threadId":"36867","inReplyTo":"1409256.vCu7BMQsbW@linux-wzza.site","subject":"Re: How to restore changes to the remote master branch to its previous stage ?","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2014-06-07T07:18:46Z","receivedAt":"2014-06-07T07:18:46Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 07.06.2014 08:07, schrieb Arup Rakshit:\n> Hi,\n> \n> I am working in a project, where I am using *Git*. Today, I have been advised  \n> by my manager to do some change and it was an urgent request. I did the change \n> and tested also, All was working fine. The big mistake I did, all the changes I \n> made in the *master* branch without creating a topic a branch. So, once I done \n> with the changes I did *git push origin master* and the changed got merged to \n> *master* branch of the remote repository. I know this is not a good practice, \n> all happened accidentally. \n> \n> Now my question is in such a case, if I see, something wrong I pushed and \n> merged to the remote repo's *master* branch, how to restore it to its previous \n> stage using *git* ? \n\nAssuming that the remote master branch is tracked in your local\nrepository, the following should do it:\n\n  git push origin origin/master@{1}:master\n\nThe plus forces a non-fast-forward push. See 'man gitrevisions' about\nthe foo@{1} syntax before you run the command.\n\n-- Hannes\n"}]}