Last active
March 23, 2018 15:00
-
-
Save ansrivas/dded9c7d68f8737d5883973eb85d4e45 to your computer and use it in GitHub Desktop.
git revert stuff
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
| # Make a steemit out of it | |
| # Delete unwanted commits from your branch | |
| git reset --hard last_working_commit_you_want | |
| git push origin master/your-branch --force | |
| # Revert a commit to a previous version | |
| git revert --no-commit b6ce5d5 | |
| git commit -m 'reverted commit' | |
| git push origin ... | |
| # delete one single commit from the middle | |
| ``` | |
| * 51a1f6b - Mon, 8 Jan 2018 17:04:15 +0100 (23 seconds ago) (HEAD -> test-branch, origin/test-branch) | |
| | actual work - Ankur Srivastava | |
| * d0918a3 - Mon, 8 Jan 2018 17:03:46 +0100 (52 seconds ago) | |
| | deliberate mistake - Ankur Srivastava | |
| * 37a4e49 - Sat, 6 Jan 2018 22:22:52 +0100 (2 days ago) (origin/master, master) | |
| Initial commit - Ankur Srivastava | |
| ``` | |
| git rebase --onto test-branch~first_commit_to_delete test-branch~first_commit_to_keep test-branch | |
| git rebase --onto test-branch~2 test-branch~1 test-branch | |
| git push origin test-branch --force | |
| ``` | |
| * 772c7de - Mon, 8 Jan 2018 17:04:15 +0100 (6 minutes ago) (HEAD -> test-branch, origin/test-branch) | |
| | actual work - Ankur Srivastava | |
| * 37a4e49 - Sat, 6 Jan 2018 22:22:52 +0100 (2 days ago) (origin/master, master) | |
| Initial commit - Ankur Srivastava | |
| ``` | |
| ## Delete branch | |
| git push -d origin test-branch | |
| git branch -d test-branch | |
| git branch -D test-branch ( force ) | |
| ### Delete one file from commits | |
| git filter-branch --index-filter 'git rm --cached --ignore-unmatch examples/get_sites_and_dump.py' --tag-name-filter cat -- --all | |
| git push --force origin your_branch | |
| ### Delete tag | |
| git tag -d 0.1.0 | |
| git push --delete origin 0.1.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment