Last active
May 25, 2017 18:11
-
-
Save carrieforde/41a416d41356bf461dac939be5e2b172 to your computer and use it in GitHub Desktop.
Git CLI
This file contains 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
## List all remote branches ## | |
git branch -r | |
## Checkout a remote branch ## | |
git branch <local branch name> <remote branch name> | |
## Push up a local branch to remote with a different name ## | |
git push origin <local branch name>:<remote branch name> # separate local and remote with a : | |
## Remove newly ignored files from remote ## | |
git rm -r --cached <some-directory> | |
git commit -m # 'Remove the now ignored directory "some-directory"' | |
git push origin master | |
## What to do with pesky .DS_Store files if they're accidentally committed. ## | |
## @link https://stackoverflow.com/questions/107701/how-can-i-remove-ds-store-files-from-a-git-repository ## | |
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch | |
## Oh shit, I just committed too many files, and need to undo the last commit 🙀 ## | |
git reset HEAD~ # this will undo the commit, but file revisions will be saved. | |
## Unstage files ## | |
git clean -f -d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment