Git pull just one commit

后端 未结 2 1020
悲&欢浪女
悲&欢浪女 2021-02-15 05:56

Actually the git repository and local files are exactly the same.

But the other website is far away from 5 commits, so I haven\'t pull in a while and I don\'t want to do

2条回答
  •  伪装坚强ぢ
    2021-02-15 06:22

    If you want to pull one commit, you can simply 'reset' to that commit..

    git reset --hard 
    

    You could also make a new branch foo off that commit and pull only that branch down to your new environment. This will help maintain your codebase as you can continue to work on your original branch without having to think about affecting the new site.

    git checkout -b foo
    

    this is shorthand for

    git branch foo
    git checkout foo
    

    You can then pull that branch onto whatever machine with

    git clone -b *foo* http//dude@:bitbucket.org
    

    or something like

    git clone -b *foo* ssh://git@bitbucket.org/path/to/repo.git
    

提交回复
热议问题