So locally, if I'm on my feature branch, I will use git rebase master - this places the commits I have on my feature branch on top of the newest commits in master. rev2023.5.1.43405. Content Discovery initiative April 13 update: Related questions using a Review our technical responses for the 2023 Developer Survey, Git: force a pull to overwrite local changes. Connect and share knowledge within a single location that is structured and easy to search. How do I safely merge a Git branch into master? It turns out the key is, "git merge savingfile2 # will be a fast-forward" <- What about adding, @weakish - that option is newer than the answer. How do I change the URI (URL) for a remote Git repository? I think the scenario description makes it clear that he doesn't really want to throw away the content. How do I discard unstaged changes in Git? yep, the @lloydmoore solution worked for me. How do I discard unstaged changes in Git? These two below-mentioned operations can be executed if we want. To understand what they do, though, you need to know how Git finds, and treats, merge conflicts. I've done this and some local files that were no longer in repo were left on the disk. Git doesn't overwrite until you mark the files with conflicts as resolved (even though if they really aren't). Can anyone help in avoiding git merge issue. The git pull command is a combination of two commands: the git fetch command. This will overwrite all the local changes done on your computer a duplicate copy of the version in the repository will appear. How do I force git pull to overwrite local files? How can I git force changes to origin master without merging? How to force overwrite local changes with 'git pull' As another_branch is base branch.So to add work done in my_branch ,First I am merging my_branch. backup your current branch - since when we force the pull, all changes will be overwritten. Asking for help, clarification, or responding to other answers. Advertisement When such an operation modifies the existing history, it is not permitted by Git without an explicit -force parameter. I had other untracked files--besides the one the merge/pull wanted to overwrite, so this solution worked best. develop - current release, bug fixes, other new features that needed to be released.