Created
October 23, 2020 19:45
-
-
Save zachgoll/14d6810af394e82e014a2abe2bc8069a to your computer and use it in GitHub Desktop.
Git revert example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # log command for reference: git log --oneline --decorate --graph --all | |
| git init | |
| touch file-1.txt | |
| git add . | |
| git commit -m "first commit" | |
| git checkout -b develop | |
| touch file-created-by-develop-branch.txt | |
| git add . | |
| git commit -m "add develop branch file" | |
| git checkout master | |
| git checkout -b feat | |
| touch file-created-by-feat-branch.txt | |
| git add . | |
| git commit -m "add feat file" | |
| git checkout develop | |
| git merge feat | |
| touch file-after-merge.txt | |
| git add . | |
| git commit -m "add file after merge" | |
| # At this point, you will need to manually run the reversion | |
| # Find the commit hash that says "add feat file", and then run the following | |
| # git revert <insert the hash here> | |
| # You should be left with the following files after all this: | |
| # file-after-merge.txt file-created-by-develop-branch.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment