Git 常用命令汇总

git status/ git diff/ git add/ git commit -m “”/ git log/ git log –pretty=oneline
git log –pretty=oneline –abbrev-commit

Revert to history version:
git reset –hard HEAD^/ git reflog/ git reset –hard (commit id)
git diff HEAD – file
if not add: git checkout – file
if add: git reset HEAD file /git checkout – file

Remove:
git rm file

Push to github
git remote add origin git@github.com:xing1992/learngit.git
git push -u origin master
git push origin master

create and change into dev: git checkout -b dev
create branch: git branch
switch branch: git checkout name
merge branch into this branch: git merge name/ git merge –no-ff -m “xxx” name
delete branch: git branch -d name
force delete branch: git branch -D name

Check origin branch: git branch -r
Delete origin branch:
git branch -r -d origin/branch-name
git push origin :branch-name

stash this branch: git stash
check stash list: git stash list
resume stash: git stash apply/ git stash drop/ git stash pop

check origin info: git remote/ git remote -v
push branch: git push origin master
checkout dev: git checkout -b dev origin/dev
pull: git pull

git push origin branch-name
git pull
git branch –set-upstream branch-name origin/branch-name
git checkout -b branch-name origin/branch-name

create a tag on this branch: git tag tagname
Show all tags: git tag
Create a tag on one commit: git tag tagname commitid
Create a tag with comment: git tag -a tagname -m “” commitid

push local tag: git push origin tag name
push all tags: git push origin –tags
Delete a local tag: git tag -d tagname
delete a origin tag: git push origin :refs/tags/tagname

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值