Guest User

Untitled

a guest
Jul 12th, 2018
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. ```
  2. 一键拉取本地上不存在的远程分支
  3.  
  4. git checkout br
  5. git pull
  6. ```
  7.  
  8. ```
  9. 查看本地以及远程分支
  10. git branch -a
  11. ```
  12.  
  13. ```
  14. 删除远程分支
  15. git push origin :br (origin 后面有空格)
  16. ```
  17.  
  18. ```
  19. 查看标签
  20. git tag
  21.  
  22.  
  23. 打标签
  24. git tag -a v1.1 -m 'my version 1.1'
  25.  
  26.  
  27. 推送本地tag到远端
  28. git push origin v1.1
  29.  
  30.  
  31. 删除本地tag
  32. git tag -d v1.1
  33.  
  34.  
  35. 删除远端tag
  36. git push origin :refs/tags/v1.1
  37. ```
  38.  
  39. ```
  40. 删除远程仓库中的提交版本
  41. git reset --hard 版本号
  42. git push origin master -f
  43. ```
  44.  
  45. ```
  46. 如何修改之前的 commit 信息
  47.  
  48. 其实并不复杂,我们只需要这样做:
  49. 1、将当前分支无关的工作状态进行暂存
  50. git stash
  51. 2、将 HEAD 移动到需要修改的 commit 上
  52. git rebase 9633cf0919^ --interactive
  53. 3、找到需要修改的 commit ,将首行的 pick 改成 edit
  54. 4、开始着手解决你的 bug
  55. 5、git add 将改动文件添加到暂存
  56. 6、git commit –amend 追加改动到提交
  57. 7、git rebase –continue 移动 HEAD 回最新的 commit
  58. 8、恢复之前的工作状态
  59. git stash pop
  60. ```
  61.  
  62.  
  63. ```
  64. 本地拉取远端git pull出错
  65.  
  66. > Pull is not possible because you have unmerged files.
  67. Please, fix them up in the work tree, and then use 'git add/rm <file>'
  68. as appropriate to mark resolution, or use 'git commit -a'
  69.  
  70. 如果想放弃本地的文件修改,可以使用git reset --hard FETCH_HEAD,FETCH_HEAD表示上一次成功git pull之后形成的commit点。然后git pull就OK了。
  71. ```
  72.  
  73. ```
  74. .gitconfig配置
  75.  
  76. [alias]
  77. co = checkout
  78. ci = commit
  79. ci0 = commit -a --allow-empty-message -m ''
  80. st = status
  81. br = branch
  82. pl = log --pretty=oneline
  83. rpl = reflog --pretty=oneline
  84. back = reset --hard
  85.  
  86. [user]
  87. name = weber-Huang
  88. email = funccn@gmail.com
  89. ```
Add Comment
Please, Sign In to add comment