###### tags: 'git' # git commands ```bash= git tag -a v1.0 -m "Added the first tag" git show git tag git push --tags origin master git log --oneline --decorate --graph --all git branch develop git branch git checkout develop git push origin develop git branch feature1 git checkout feature1 git tag -a v1.1 -m "Added second release tag" ``` undo last commit ```bash= git reset --soft HEAD~1 ``` git stash ```bash= git stash git stash list ``` ### user config Git uses a hierarchical config approach in which settings of a broader scope are inherited if not overriden. * **all users**: `/etc/git` * **global**:`$HOME/.gitconfig` * **local repository**: `.git/config` ```bash= git config --global user.email "pauly.k@gmail.com" git config --global user.name "Paul Krisadaolarn" git config --list ``` ### git rebase ```bash= mkdir test-git ; cd $_ ; git init; touch m-a ; git aacm m-a ; touch m-b ; git aacm m-b git checkout -b feat1 touch f1 ; git aacm f1; touch f2; git aacm f2; git checkout master touch m-c ; git aacm m-c ; touch m-d; git aacm m-d git rebase feat1 ``` ### git set default branch repository > settings > branches > default branch > switch to another branch ### git tags ```bash= git tag -a v1.0 -m "release version 1.0" git tag -n git show v1.0 git tag -d v1.4 ``` ### delete remote branch ```bash= git push origin --delete branch-name ``` ### git cherry pick todo ### git revert The git revert command is a forward-moving undo operation that offers a safe method of undoing changes. Instead of deleting or orphaning commits in the commit history, a revert will create a new commit that inverses the changes specified.
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up