Questions tagged [git-merge]

git-merge is a git command which integrates changes from another branch by incorporating commits into the currently checked-out branch.

A merge in version control is an operation where two sets of changes are combined to have both features available.

Git provides sophisticated merge support by automatically detecting simple merges (i.e. if only changes on one branch happened, also called fast-forward) and allowing plugable merge-strategies for more advanced use-cases.

3320 questions
135
votes
10 answers

How to update my working Git branch from another branch (develop)?

I made a new branch called feature1 from the main develop branch a month ago. ⇒ git branch develop * feature1 I've been working on feature1 for a month now and a lot of changes have been pushed to develop. How can I update my current branch…
Eki Eqbal
  • 5,779
  • 9
  • 47
  • 81
128
votes
6 answers

Git merge left HEAD marks in my files

I tried to merge a file in the command line using Git, when an error message appeared telling me the merge was aborted. I thought that was the end of it, but then I realized there are gitmarks in my files. Like so: start = expression validchar…
lowerkey
  • 8,105
  • 17
  • 68
  • 102
119
votes
2 answers

How to resolve git status "Unmerged paths:"?

I merged branch dog into animal. When I go to commit, I get the following: Unmerged paths: (use "git reset HEAD ..." to unstage) (use "git add ..." to mark resolution both deleted: ../public/images/originals/dog.ai added by them: …
keruilin
  • 16,782
  • 34
  • 108
  • 175
119
votes
5 answers

How Do I 'git fetch' and 'git merge' from a Remote Tracking Branch (like 'git pull')

I have set up some remote tracking branches in git, but I never seem to be able to merge them into the local branch once I have updated them with 'git fetch'. For example, suppose I have remote branch called 'an-other-branch'. I set that up locally…
kaybenleroll
  • 16,794
  • 16
  • 54
  • 66
115
votes
3 answers

Have Git Select Local Version On Merge Conflict on a Specific File?

Say I'm collaborating with someone via a git repository, and there is a particular file that I never want to accept any external changes to. Is there any way to set up my local repo to not complain about a conflicted merge every time I git pull? I'd…
saffsd
  • 23,742
  • 18
  • 63
  • 67
115
votes
2 answers

GIT warning: too many files skipping inexact rename detection

I am aware that the default rename limit is 100 and we can increase this value using the config diff.renamelimit config What I am worried about is that, if this config is not setup, will there be a wrong merge or any missing code? I am trying to…
Senthil A Kumar
  • 10,306
  • 15
  • 44
  • 55
115
votes
10 answers

How to set Meld as git mergetool

I've set: git config --global merge.tool meld git config --global mergetool.meld.path c:/Progra~2/meld/bin/ On "git mergetool" it writes: Hit return to start merge resolution tool (meld): The merge tool meld is not available as…
Paul
  • 25,812
  • 38
  • 124
  • 247
112
votes
7 answers

Found a swap file by the name

When I try to merge my branch with a remote branch: git merge feature/remote_branch I got this message: E325: ATTENTION Found a swap file by the name ".git/.MERGE_MSG.swp" owned by: xxxxxx dated: Mon Nov 12 23:17:40 2012 file…
Malloc
  • 15,434
  • 34
  • 105
  • 192
104
votes
7 answers

How to merge all files manually in Git?

I want to merge all files manually with meld or any other diff tool, how can I do this with Git? When I run git mergetool it says no files need merging. So I suppose I can do it only if I have conflicts.
gennad
  • 5,335
  • 12
  • 44
  • 47
103
votes
6 answers

How to do a fast-forward merge on GitHub?

So one of my colleagues attempted to merge a branch using GitHub's "merge via fast-forward" option in the web-interface, to keep the history clean from bogus merge commits (the master branch into which they merged, had not progressed since the to-be…
umläute
  • 28,885
  • 9
  • 68
  • 122
101
votes
3 answers

Git undo merge attempt

I have working directory (#1) which has vendor directory(#2) in it. There is one dependency which I wanted to pull manually without composer (php version of npm/gem). I was working in #1, haven't saved/commited changes, when I decided I want to…
ewooycom
  • 2,651
  • 5
  • 30
  • 52
99
votes
7 answers

Git pull - Please move or remove them before you can merge

I am trying to do a git pull origin master from my server but keep getting the error: Please move or remove them before you can merge. There are no untracked files, but it seems like it has issues with the ignored files for some reason. I tried…
Brett
  • 19,449
  • 54
  • 157
  • 290
81
votes
2 answers

How to merge two branches with different directory hierarchies in git?

I started using Maven with a web application project so the directory hierarchy changed. I created a new branch for the Maven integration. Now I have two branches one with the old directory hierarchy and one with the maven directory hierarchy. Both…
anssias
  • 1,994
  • 2
  • 16
  • 21
81
votes
10 answers

how can I customize git's merge commit message?

Every time I do a merge I need for a merge commit to be generated and I would like it to have more than just the summary of all the commits. My question is how can I format git-fmt-merge-msg or what determines this automated message (I can do this…
shil88
  • 1,449
  • 1
  • 11
  • 13
81
votes
12 answers

How to resolve git error: "Updates were rejected because the tip of your current branch is behind"

A well meaning colleague has pushed changes to the Master instead of making a branch. This means that when I try to commit I get the error: Updates were rejected because the tip of your current branch is behind I know this should be resolved by…
Finglish
  • 9,692
  • 14
  • 70
  • 114