Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/max-lobur/git-tips
Various tips pinned from Pro Git (never gets old)
https://github.com/max-lobur/git-tips
git tips tips-and-tricks tutorials
Last synced: 19 days ago
JSON representation
Various tips pinned from Pro Git (never gets old)
- Host: GitHub
- URL: https://github.com/max-lobur/git-tips
- Owner: max-lobur
- License: mit
- Created: 2017-02-01T14:29:30.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-01T21:39:55.000Z (over 7 years ago)
- Last Synced: 2024-11-03T09:30:52.230Z (2 months ago)
- Topics: git, tips, tips-and-tricks, tutorials
- Homepage: https://git-scm.com/book/en/v2
- Size: 2.93 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### Tips saved while reading [Pro Git](https://git-scm.com/book/en/v2):
```
git diff : compare current with staged (or with last commit if no staged one)
git diff —staged : compare staged with last commit
git diff … : show diff introduced by topicbr comparing to master (base commit in master)
git diff : show diff betwheen latest commit of current branch and other commit (sha-1)git log -n : view last n commits
git log -n -p : last n commits with summary of changes (diff)
git log -n —graph : graphical view branch history
git log —pretty=oneline : each commit at one line
git log —not : list commits which are in br1 but not in br2
git log —not : list commits which are in br1 and br2 but not br3
git log .. : show commits that reachable from topic but not from master (—||—)
git log origin/master..HEAD : show what will be pushed to remote in case of push (—||—)
git log … : show commits not reachable from both branches semitaneousely (not shared)
git log —left-right … : same to previous, but show which commit at which branchgit remote -v : list remotes
git remote add : add remote
git remote show [remote] : details of remote
git remote rename : rename remote
git remote rm : delete remote referencegit reset HEAD [file] : unstage file or all files
git checkout — [file | *] : revert unstaged file (* for all files) to last commit state
reset HEAD; checkout * : revert all the changes in current branch
git reset --hard origin/master : revert to remote stategit checkout -b : make a new branch basing on current
git checkout -b / : make a local copy of branch fetched from remote (tracking copy)
git checkout -—track / : —||—
git checkout -b : make a new branch basing on some commit and switch to it
git checkout -b : make a new branch basing on other branch and switch to itgit branch -d : delete branch
git branch -v : list branches with last commit for each
git branch —merged : list branches merged to current (can be deleted)
git branch —no-merged : list all not merged to currentgit fetch [remote] : get data from remote (not merge with local)
git pull [remote] : get data from remote and merge into local
git push [remote] [branch] : send branch state to remote
git push [remote] [:] : same but with diff name of remote branch
git push : : remove branch on remote servergit tag : list all available tags
git tag -l “*” : filter tags by pattern
git tag : create lightweight tag for last commit
git tag : create tag for not the latest commit
git tag -a -m : create annotated tag (-s instead -a --> signed tag)
git show : show commit marked by tag, and tag’s info
git tag -v : verify signed tag
git push : push tag to remote
git push —tags : push all tags to remote
git describe [branch] : get current branch state (latest tag + number of commits after); kind of build numbergit merge : merge specified branch into current
git rebase : rebase current branch to the latest commit of
git rebase —onto : rebase br2 from br1 to latest tarbr separately from any changes made within br1
git rebase -i HEAD~3 : change last 3 commits (like amend but for n commits)
DO NOT rebase commits that were pushed to remote!
git merge-base : show common ancestor of the two branches
git cherry-pick : rebase specified commit to the top of current branch
git stash : save all uncommitted changes from current branch and clear branch to not changed
git stash list : list stashes
git stash apply [stash@{n}] : apply latest stash if not specified, apply n-th stash otherwise
git stash apply —index : apply latest stash including “staged” states of the files
git stash drop : delete stash
stash -> checkout another branch -> stash apply : move changes from one branch to another
git stash branch : make a new branch from stash and remove stash
git filter-branch —tree-filter ‘’ HEAD [—all] : apply ‘cmd' to each commit in current branch or all branches
git blame : annotate the file
git bisect : interactive binary search of the commit that introduced a bug
git config —global core.excludesfile : set common .gitignore for all files
git config —global color.ui true : colour output
```