develop via a single branch
bash
t branch -m {{branch}}
git fetch origin
git rebase origin/master -i
git push origin {{branch}}
create a new branch
bash
git checkout -b {{branch}}
checkout remote branch
bash
git checkout -b {{branch}} origin/{{branch}}
merge branch to master
bash
git checkout master
git merge {{branch}}
delete branch
bash
git branch -D {{localBranch}}
git push --delete origin {{remoteBranch}}
rename repo
bash
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
bash
git tag {{tag}}
git push --tags
add tag for a history commit
bash
// 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
bash
git tag --delete {{tag}}
git push --delete origin {{tag}}
gh-pages
bash
http://{{group}}.github.io/{{repo}}/
npm add owner
bash
npm owner add {{name}}
一些链接
转自:https://github.com/fool2fish/issues/9
文章信息
- 文章标题:Git-常用命令 - Keystion
- 文章链接:https://webclown.net/posts/git-常用命令.html
- 版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。
- 转载请注明来自 Keystion !
markdown
[Git-常用命令 - Keystion](https://webclown.net/posts/git-常用命令.html)