FAQ

Q: if I git reset [commit] to some previous commit, how do I go back?

git reset --soft HEAD@{1}

Q: how to revert a commit?

# Resets index to former commit; replace '56e05fced' with your commit code
git reset 56e05fced 

# Moves pointer back to previous HEAD
git reset --soft HEAD@{1}

git commit -m "Revert to 56e05fced"

# Updates working copy to reflect the new commit
git reset --hard

Q: how to revert a merge commit?

first, look at the merge commit details using: git show [merge-commit]

commit 8f937c683929b08379097828c8a04350b9b8e183
Merge: 8989ee0 7c6b236
Author: Ben James <[email protected]>
Date:   Wed Aug 17 22:49:41 2011 +0100

Merge branch 'gh-pages'

Conflicts:
    README

http://stackoverflow.com/questions/7099833/how-to-revert-a-merge-commit-thats-already-pushed-to-remote-branch


Q: how to use git rebase? how is it differ from git merge?

https://www.atlassian.com/git/tutorials/merging-vs-rebasing/


results matching ""

    No results matching ""