Git常用命令

  • git add
  • git commit
  • git branch :显示本地所有分支,前面有*的是当前分支
  • git check -b name :在本地新建一个name分支
  • git check master :跳转到master分支
  • git merge dev:将dev分支合并到当前分支
  • git push:推代码到远端
  • git push origin localbranch:remotebranch : 将本地代码推到远程的origin用户下,将本地的localbranch分支推到远程的remotebranch分支下。
  • git remote add:新建远程仓库
  • git branch -d name : 删除name分支
  • git cherry-pick  f2bef0d56108d3c2de0321: 将哈希码为f2bef0d56108d3c2de0321的提交放到当前分支的最前面:
a - b - c - d   Master
         \
           e - f - g Feature

经过cherry-pick commit f后:

a - b - c - d - f   Master
         \
           e - f - g Feature
  • git stash : git add之后,但还没有git commit的内容,通过此命令之后隐藏
  • git stash apply: 将git stash隐藏的代码恢复出来
  •  

你可能感兴趣的:(其他)