Skip to content

Git-常用命令

发表于:

文章分类:tech

文章标签:gitgh-pages

阅读量:

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

上一篇
下一篇
总访问量:-