Git : how to accept all current/incoming changes

Git is the most popular version control systems in the world. By taking snapshots, it keeps track of every change made on the project. A project can be rolled back to any previous version/status easily.

Initially, Git was intended for use by software development teams. However, it’s flexible enough for virtually any file type. Git can be used by anyone, whether you’re a teacher, a businessperson, a graphic designer, or a content writer.

As a team member using Git for collaboration, you may sometimes find yourself in a tricky situation where everyone is working on the same project at the same time. Depending on the number of changes we are trying to commit, these situations might make the process more challenging or time-consuming.

The scenario

Let’s say you have to work on a new feature that you are really excited about. It therefore makes sense for you to create a new branch.

When you have completed all the changes necessary to achieve your goal, let’s suppose you now need to merge the old branch, from which you have created the new feature branch, with the current branch. Before you go ahead with the merge, you notice there are several new commits on the branch made by other people.


In spite of the fact that you noticed it, you think the changes in the old branch won’t affect yours, therefore the merge command is executed within the your branch. You now continue to merge it.

$ (awesome-new-feature) git merge original-branch
Code language: JavaScript (javascript)

You’ll encounter the following error message.

Auto-merging index.html CONFLICT (content): Merge conflict in index.html Automatic merge failed; fix conflicts and then commit the result.
Code language: CSS (css)

There are literally hundreds of changes, it would not make sense to manually handle all of them.

Git : accept all current changes

According to the git checkout man page, the command has options called --theirs and --ours. One will keep the merged version, and the other will keep the original one.

These options mentioned above are only available in Git versions 1.6.1 and later.

In order to quickly accept all current changes (which means our changes in Git’s terms) in, for example,, you have to run the following command.

(awesome-new-feature) git checkout --ours
Code language: JavaScript (javascript)

Following this, you come back to Git and explicitly specify that you fixed the conflict by adding the file to the Index by running.

(awesome-new-feature) git add
Code language: JavaScript (javascript)

If you want to ignore all changes made by others in the branch, keeping only what you created, you can cd to the repository and run git against the current directory.

(awesome-new-feature) git checkout --ours .
Code language: JavaScript (javascript)

Git : accept all incoming changes

Similar to how we used --ours to ignore incoming changes, you can use --theirs to ignore all changes made by yourself and merge other commits.

(awesome-new-feature) git checkout --theirs (awesome-new-feature) git add
Code language: JavaScript (javascript)

In the case that you wish accept all incoming changes in the branch, you can cd to the repository and run git against the current directory.

(awesome-new-feature) git checkout --theirs .
Code language: JavaScript (javascript)

Manage Git conflicts in VSCode

Visual Studio Code has excellent Git integration, incorporate most popular commands into its GUI.

The Git merge strategies mentioned above can be performed in VSCode quickly by opening Command Palette and search for "merge", you can see the Accept all current changes along with all other possible options.

Manage git conflicts in VSCode

Alternatively, you can select files in the sidebar, right-click and select Accept All Incoming or Accept All Current based on your specific scenario.

Accept All Incoming Git changes in VSCode

We hope that the short article gave you useful information on how to accept multiple current or incoming changes all at once. You may want to check out our other Git guides such as how to handle merge conflicts in VSCode, clone a private Github repository or push to specific remote Git branch If you have any question, don’t hesitate to let us know in the comments section below.

Leave a Comment