How can I selectively merge or pick changes from another branch in Git?

前端 未结 25 1566
慢半拍i
慢半拍i 2020-11-22 02:53

I\'m using Git on a new project that has two parallel -- but currently experimental -- development branches:

  • master: import of existing codebase pl
25条回答
  •  渐次进展
    2020-11-22 03:03

    This is my workflow for merging selective files.

    # Make a new branch (this will be temporary)
    git checkout -b newbranch
    
    # Grab the changes
    git merge --no-commit  featurebranch
    
    # Unstage those changes
    git reset HEAD
    (You can now see the files from the merge are unstaged)
    
    # Now you can chose which files are to be merged.
    git add -p
    
    # Remember to "git add" any new files you wish to keep
    git commit
    

提交回复
热议问题