Reputation: 2000
So part of the work I've been doing on a branch of a Git repository has involved removing unused files. eg.
git rm "unused-file.txt"
git commit -m "clean up things"
How can I best merge changes like this (along with my other normal commits on existing files) back into master? If I:
git checkout master
git merge my_branch
Git's auto-merge just leaves the files I deleted on my branch in place, as they don't conflict with the ones still there on master.
Any help much appreciated!
Upvotes: 0
Views: 241
Reputation: 1236
Hi I think add the deleted file in your working directory to Index after deleting which will show that the file is deleted in the Index and update while merging.
git checkout my_branch
git rm "unused-file.txt"
git status
git add unused-file.txt || git add .
git commit -m "Clean up things"
git checkout master
git merge my_branch
I think this is want you are looking for. Let me know if this works
Upvotes: 1