Here I will post command that usually use but sometime forget syntax, so rewriting them again with explanation help me to remember them :) :
remove all files from staging area - "git reset HEAD"
add to staging area only modified files - "git add -u"
remove all newly created files from working folder - "git clean -f"
change comment of the last commit - "git commit --amend"
get all remote branches to local repository - "git fetch"
create local branch base on existent remote branch - "git checkout -b development remotes/origin/development"
push to remote branch with 'force' after rebase - "git push --force origin SYS-551"
create new branch base on non commited changes - "git checkout -b short-status-form-sb" after that do "git add filepath ; ...."
push to remote newly created local branch - "git push origin my-new-feature"
show history of changes in terminal - "git log --oneline --decorate --graph"
show history of changes in UI - "gitk" or "gitk --all"
remove branch from local repository - "git branch -D SYS-551"
remove branch from remote repository - "git push origin --delete SYS-551"
SVN style looks for logs output - "status -sb"
See all changes that are going to be pushed - "git diff --stat origin/master" or "git diff origin/master".
Get only the work your current topic branch has introduced since its common ancestor with master: "git master...test"
Revert one commit (revert changes that were done by commit) "git revert <SHA-1>"
Remove last commit completely from local repo - "git reset HEAD~1 --hard"
Find out which branch contains a change - "git branch --contains 50f3754"
Find out if a change is part of a release - "git name-rev --name-only 50f3754"
Get rid of all changes/commits in branch to remote git state "git reset --hard origin"
Convenient aliases, source:
remove all files from staging area - "git reset HEAD"
add to staging area only modified files - "git add -u"
remove all newly created files from working folder - "git clean -f"
change comment of the last commit - "git commit --amend"
get all remote branches to local repository - "git fetch"
create local branch base on existent remote branch - "git checkout -b development remotes/origin/development"
push to remote branch with 'force' after rebase - "git push --force origin SYS-551"
create new branch base on non commited changes - "git checkout -b short-status-form-sb" after that do "git add filepath ; ...."
push to remote newly created local branch - "git push origin my-new-feature"
show history of changes in terminal - "git log --oneline --decorate --graph"
show history of changes in UI - "gitk" or "gitk --all"
remove branch from local repository - "git branch -D SYS-551"
remove branch from remote repository - "git push origin --delete SYS-551"
SVN style looks for logs output - "status -sb"
See all changes that are going to be pushed - "git diff --stat origin/master" or "git diff origin/master".
Get only the work your current topic branch has introduced since its common ancestor with master: "git master...test"
Revert one commit (revert changes that were done by commit) "git revert <SHA-1>"
Remove last commit completely from local repo - "git reset HEAD~1 --hard"
Find out which branch contains a change - "git branch --contains 50f3754"
Find out if a change is part of a release - "git name-rev --name-only 50f3754"
Get rid of all changes/commits in branch to remote git state "git reset --hard origin"
Convenient aliases, source:
git config --global alias.st "status -sb" git config --global alias.ci commit git config --global alias.co checkout git config --global alias.br branch git config --global alias.bra "branch -a" git config --global alias.chp cherry-pick git config --global alias.pr "pull --rebase" git config --global alias.bl "blame -b -w" git config --global alias.cia "commit --amend" git config --global alias.lg "log --pretty=format:'%h was %an, %ar, message: %s' --graph" git config --global alias.who "shortlog -s --"
from Daniil Yaroslavtsev:
git config --global alias.l "log --graph --pretty=format:'%Cred%h%Creset %C(bold blue)<%an>%Creset%C(yellow)%d%Creset %s %Cgreen(%cr)' --abbrev-commit --date=relative"
No comments:
Post a Comment