Git 进阶

2018-11-24  本文已影响0人  蚍蜉showtime

一、进阶命令

1.git fetch

到远程仓库中拉取所有本地仓库中还没有的数据,但只是拉取,不自动进行分支合并,需要手工进行,区别于git pull。

2.git remote show

查看远程仓库的信息

$ git remote show origin
* remote origin
  URL: git@github.com:name/github.git
  //在issues和master分支上执行 git pull 对应的远端分支
  Remote branch merged with 'git pull' while on branch issues
    issues
  Remote branch merged with 'git pull' while on branch master
    master
  //远端还没fetch到本地的新分支
  New remote branches (next fetch will store in remotes/origin)
    caching
  //本地还有,远端以及被删除的分支
  Stale tracking branches (use 'git remote prune')
    libwalker
    walker2
  Tracked remote branches
    acl
    apiv2
    dashboard2
    issues
    master
    postgres
  //本地执行push对应关联的的分支
  Local branch pushed with 'git push'
    master:master

3. 只拉取感兴趣的commit之,git cherry-pick

4. 去除很久之前的某次提交,git revert

上一篇 下一篇

猜你喜欢

热点阅读