git-tips / tips
- суббота, 4 июня 2016 г. в 03:13:07
JavaScript
Most commonly used git tips and tricks.
Collection of
git-tips
, want to add your tips? Checkout contributing.md
master
branch.gitignore
.git help everyday
git help -g
git fetch --all && git reset --hard origin/master
git ls-tree --name-only -r <commit-ish>
git update-ref -d HEAD
git diff --name-only --diff-filter=U
git diff-tree --no-commit-id --name-only -r <commit-ish>
git diff
git diff --cached
git diff HEAD
git checkout master && git branch --merged
git checkout -
git branch --merged | grep -v '\*' | xargs -n 1 git branch -d
git branch -vv
git branch -u origin/mybranch
git branch -d <local_branchname>
git push origin --delete <remote_branchname>
Alternatives:
git push origin :<remote_branchname>
git checkout -- <file_name>
git revert <commit-ish>
git reset <commit-ish>
git commit -v --amend
git commit --amend --author='Author Name <email@address.com>'
git commit --amend --reset-author --no-edit
git remote set-url origin <URL>
git remote
Alternatives:
git remote show
git branch -a
git branch -r
git add -p
curl http://git.io/vfhol > ~/.git-completion.bash && echo '[ -f ~/.git-completion.bash ] && . ~/.git-completion.bash' >> ~/.bashrc
git whatchanged --since='2 weeks ago'
git log --no-merges --stat --reverse master..
git checkout <branch-name> && git cherry-pick <commit-ish>
git branch -a --contains <commit-ish>
Alternatives:
git branch --contains <commit-ish>
git config --global alias.<handle> <command>
git config --global alias.st status
git stash
Alternatives:
git stash save
git stash save -u
Alternatives:
git stash save --include-untracked
git stash list
git stash apply <stash@{n}>
git stash pop
Alternatives:
git stash apply stash@{0} && git stash drop stash@{0}
git stash clear
Alternatives:
git stash drop <stash@{n}>
git checkout <stash@{n}> -- <file_path>
Alternatives:
git checkout stash@{0} -- <file_path>
git ls-files -t
git ls-files --others
git ls-files --others -i --exclude-standard
git worktree add -b <branch-name> <path> <start-point>
git worktree add --detach <path> HEAD
git rm --cached <file_path>
Alternatives:
git rm --cached -r <directory_path>
git clean -n
git clean -f
git clean -f -d
Alternatives:
git clean -df
git submodule foreach git pull
git cherry -v master
Alternatives:
git cherry -v master <branch-to-be-merged>
git branch -m <new-branch-name>
Alternatives:
git branch -m [<old-branch-name>] <new-branch-name>
git checkout feature && git rebase @{-1} && git checkout @{-2} && git merge @{-1}
master
branchgit archive master --format=zip --output=master.zip
git add --all && git commit --amend --no-edit
git fetch -p
Alternatives:
git remote prune origin
git rev-list --reverse HEAD | head -1
git log --pretty=oneline --graph --decorate --all
Alternatives:
gitk --all
git subtree push --prefix subfolder_name origin gh-pages
git subtree add --prefix=<directory_name>/<project_name> --squash git@github.com:<username>/<project_name>.git master
git subtree pull --prefix=<directory_name>/<project_name> --squash git@github.com:<username>/<project_name>.git master
git bundle create <file> <branch-name>
git clone repo.bundle <repo-dir> -b <branch-name>
git rev-parse --abbrev-ref HEAD
git update-index --assume-unchanged Changelog; git commit -a; git update-index --no-assume-unchanged Changelog
git rebase --autostash
git fetch origin pull/<id>/head:<branch-name>
Alternatives:
git pull origin pull/<id>/head:<branch-name>
git describe --tags --abbrev=0
git diff --word-diff
git update-index --assume-unchanged <file_name>
git update-index --no-assume-unchanged <file_name>
.gitignore
.git clean -X -f
git checkout <deleting_commit>^ -- <file_path>
git checkout <commit-ish> -- <file_path>
git config --global branch.autosetuprebase always
git config --list
git config --global core.ignorecase false
git config --global help.autocorrect 1
git name-rev --name-only <SHA-1>
git clean -fd --dry-run
git commit --fixup <SHA-1>
git rebase -i --autosquash
git commit -am <commit message>
git check-ignore *
git status --ignored
git log Branch1 ^Branch2
git config --global rerere.enabled 1
git diff --name-only | uniq | xargs $EDITOR
git count-objects --human-readable
git gc --prune=now --aggressive
git instaweb [--local] [--httpd=<httpd>] [--port=<port>] [--browser=<browser>]
git log --show-signature
git config --global --unset <entry-name>
git checkout --orphan <branch_name>
git diff --staged
git show <banch_name>:<file_name>
git log --first-parent
git rebase --interactive HEAD~2