Last active
September 4, 2017 17:32
-
-
Save n0an/ab4ab49ae99f3ebf443bd2aa9bef95ef to your computer and use it in GitHub Desktop.
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
### Shortlog | |
git shortlog | |
* -n | |
* -sn | |
### Amend LAST commit (message or files): | |
git commit --amend -m "Added some files or just edited comm message" | |
### Search through git log: | |
git log -i -- grep="Some Text" | |
### Show commits only by Joe Groff: | |
git log --author Groff | |
### Short status | |
git status -s | |
### Shows you the list of available branches” | |
git branch -v | |
### Show branches that exist remotely | |
git branch -r | |
### Show all branches | |
git branch -a | |
### Shows remote servers: | |
git remote -v | |
### Adding, removing, viewing remote servers | |
git remote add remote_server | |
git remote remove remote_server | |
git remote show remote_server | |
### Remove file from Staged: | |
git reset | |
### Show only branches merged/no-merged to current active branch | |
git branch --no-merged | |
git branch --merged | |
### Show commits in specified branch: | |
git log branch_name | |
### See which changes are in testing branch that aren’t in master: | |
git log testing ^master | |
### Merge without Fast Forward: | |
git merge --no-ff branch_name | |
## Rebase and cherry-pick | |
### Rebase current active branch to another branch: | |
git rebase branch_name | |
### Cherry pick specified commit: | |
git cherry-pick SHA_OF_COMMIT | |
----------- BEGINNING GIT RW COURSE ----------- | |
### Interactive adding: | |
git add -i | |
### Diff staged: | |
git diff --staged | |
### Reset from staged: | |
git reset HEAD filename | |
### Decorated branches graph: | |
git log --oneline --graph --decorate --all | |
### Fetching merging | |
git remote show origin | |
git remote -v | |
git branch -vv | |
git branch -vv -all | |
### Delete remote branch after deleting local branch: | |
git remote prune | |
----------- MASTERING GIT RW COURSE ----------- | |
### Merge conflicts with GUI: | |
git config merge.tool opendiff | |
git mergetool | |
cmd-s cmd-q | |
rm .orig file | |
git add | |
git commit | |
### Aliases: | |
git config --global alias.gl 'log --oneline --decorate --graph --all' | |
git gl | |
cat ~/.gitconfig | |
### Gitignore Problem (tracking files after adding to gitignore): | |
### 1. Tell Git to ignore file, added to gitignore, but still tracked: | |
git update-index --assume-unchanged IGNORE_ME | |
git ls-files -v | |
git ls-files -v | grep '^[[:lower:]]' | |
### Start tracking changes in file: | |
git update-index --no-assume-unchanged IGNORE_ME | |
### 2. rm --cached: | |
git rm --cached IGNORE_ME | |
git commit -m "Remove IGNORE_ME" | |
### 3. Remove file from all history: | |
git filter-branch --index-filter 'git rm --cached --ignore-unmatch -- SECRETS' --prune-empty -f HEAD | |
## Cherry picking | |
git log -p be3a48a | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment