git checkout -b BID-XXX origin/develop
//Do Development here.
git checkout develop // Switch branch to'develop'
git merge --no-ff BID-XXX // Update
git branch -d BID-XXX // Deleted branch BID-XXX
git push origin develop // Push
git push origin :ui-r19
git push origin new_remote_branch
git branch -m old_branch new_branch
git rm -r --cached .
# reset the index to the desired tree
git reset 56e05fced
# move the branch pointer back to the previous HEAD
git reset --soft HEAD@{1}
git commit -m "Revert to 56e05fced"
# Update working copy to reflect the new commit
git reset --hard
This depends a lot on what you mean by "revert".
If you want to temporarily go back to it, fool around, then come back to where you are, all you have to do is check out the desired commit:
git checkout 0d1d7fc32 or if you want to make commits while you're there, go ahead and make a new branch while you're at it:
git checkout -b old-state 0d1d7fc32 If, on the other hand, you want to really get rid of everything you've done since then, there are two possibilities. One, if you haven't published any of these commits, simply reset:
git reset --hard 0d1d7fc32
git stash git reset --hard 0d1d7fc32 git stash pop
On the other hand, if you've published the work, you probably don't want to reset the branch, since that's effectively rewriting history. In that case, you could indeed revert the commits. With git, revert has a very specific meaning: create a commit with the reverse patch to cancel it out. This way you don't rewrite any history.
git revert 0766c053 25eee4ca a867b4af
git checkout 0d1d7fc32 .
git commit # be sure and write a good message describing what you just did The git-revert manpage actually covers a lot of this in its description. Another useful link from the Git Community Book discussing git-revert is here.