Git: How to update/checkout a single file from remote origin master?

后端 未结 7 929
长发绾君心
长发绾君心 2020-12-12 08:41

The scenario:

  1. I make some changes in a single file locally and run git add, git commit and git push
  2. The file is
7条回答
  •  攒了一身酷
    2020-12-12 09:41

    What you can do is:

    1. Update your local git repo:

      git fetch

    2. Build a local branch and checkout on it:

      git branch pouet && git checkout pouet

    3. Apply the commit you want on this branch:

      git cherry-pick abcdefabcdef

      (abcdefabcdef is the sha1 of the commit you want to apply)

提交回复
热议问题