Keystion的小博客

Git-常用命令

develop via a single branch

1
2
3
4
t branch -m {{branch}}
git fetch origin
git rebase origin/master -i
git push origin {{branch}}

create a new branch

1
git checkout -b {{branch}}

checkout remote branch

1
git checkout -b {{branch}} origin/{{branch}}

merge branch to master

1
2
git checkout master
git merge {{branch}}

delete branch

1
2
git branch -D {{localBranch}}
git push --delete origin {{remoteBranch}}

rename repo

1
2
3
4
5
6
7
git remote -v
// View existing remotes
// origin https://github.com/user/repo.git (fetch)
// origin https://github.com/user/repo.git (push)

git remote set-url origin https://github.com/user/repo2.git
// Change the 'origin' remote's URL

add tag

1
2
git tag {{tag}}
git push --tags

add tag for a history commit

1
2
3
4
5
6
7
8
9
10
// Set the HEAD to the old commit that we want to tag
git checkout {{leading 7 chars of commit}}

// temporarily set the date to the date of the HEAD commit, and add the tag
GIT_COMMITTER_DATE="$(git show --format=%aD | head -1)" git tag -a {{tag}} -m "{{commit message}}"

// set HEAD back to whatever you want it to be
git checkout master

git push --tags

delete tag

1
2
git tag --delete {{tag}}
git push --delete origin {{tag}}

gh-pages

1
http://{{group}}.github.io/{{repo}}/

npm add owner

1
npm owner add {{name}}

Source:fool2fish

一些链接

Keystion wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!
来一杯咖啡~
Keystion WeChat Pay

微信打赏

Keystion Alipay

支付宝打赏