Git|Git使用中常用命令

【Git|Git使用中常用命令】1、创建分支: git branch
2、查看本地所有分支:git branch -a
3、切换分支:git checkout
4、合并代码到当前分支:git merge
5、新建tag: git tag -a -m "注释"
6、查看所有tags:git tag
7、查看tag详情:git show
8、版本回退:git reset --hard
9、查看所有提交日志:git reflog
10、推送所有tags到远程:git push origin --tags
11、将uncommit代码贮藏(临时保存):git stash save "stash-name"
12、查看所有stash代码:git stash list
13、应用stash代码(apply last stash and remove it from the list):git stash pop
14、应用stashd代码(apply stash with stash@{n}):git stash apply stash@{1}
15、清空临时贮藏列表:git stash clear
16、修改项目远程仓库地址:git remote set-url origin newAddr ,进入.git/下查看 config信息是否变更;

通过tag修复bug流程:
1、查看项目所有tag
1)git tag
2、查询tag详情找到commitId
1)git show
3、主分支回退到打标签的那次提交
1)git reset --hard
4、拉取分支
1)bugfix git checkout -b
5、主分支立即回到最新状态
1)git checkout master
2)git reflog
3)git reset --hard (回到最新版本)
6、切换到bugfix分支,修改bug,发版本,打新标签
1)git checkout
7、合并bugfix分支到主干上
1)git checkout master
2)git merge
3)git push origin master
8、手动推送标签到远程
1)git push origin --tags


















    推荐阅读