In git I created a new branch feature-scheduling
and made some changes. I have not committed any of the changes though (all uncommitted) .
I want to merge some (not all) of the changed files in the branch feature-scheduling
into master
, keeping the changes in both the branch and master.
How is this done?
Here is the solution.
Create two commits on the branch. The first with all the changes I want to merge into master
. The second with everything else.
Then:
git log --pretty=format:'%h' -n 2
Note the second hash, this is needed for merging.
git checkout master
git merge {hash of commit from above}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.