Last active
August 5, 2020 23:46
-
-
Save steveosoule/49234382bc1d91e0644ced8bbe7a4f28 to your computer and use it in GitHub Desktop.
Git Commands
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
| # To sort branches by commit date | |
| git branch --sort=-committerdate | |
| # Checkout previous branch | |
| git checkout - | |
| # List branches along with commit ID, commit message and remote | |
| git branch -vv | |
| # Copy file from another branch to current branch | |
| git checkout feature/my-other-branch -- thefile.txt | |
| # Shorten the status output | |
| git status -sb | |
| # Begin the bisect | |
| git bisect start | |
| # Tell git which commit does not have the bug | |
| git bisect good c5ba734 | |
| # Tell git which commit does have the bug | |
| git bisect bad 6c093f4 | |
| # Tell git to run a specific script on each commit | |
| # For example you could run a specific script: | |
| git bisect run ./test-bug | |
| # Or use a test runner | |
| git bisect run jest | |
| # This will run for every commit between current and the given commit ID | |
| git rebase -i --exec ./my-script | |
| # Reading | |
| # https://www.smashingmagazine.com/make-life-easier-when-using-git/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment