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
59
votes
3 answers

Git rebase (Merge Squash) my feature branch onto another branch

I'm looking for a git command to help me with my feature branches when they're ready to go into Master. This git command would squash all my changes on my branch into a single commit on top of master. I do this today with: git rebase…
John Hinnegan
  • 5,864
  • 2
  • 48
  • 64
59
votes
3 answers

What exactly is a merge conflict?

I have made a git repository and added a text file to it. This is 100% for learning purpose. I added "1" to the text file and committed it to master. Created a new branch from master and appended "2". Finally, created a branch from master and…
user3693167
  • 783
  • 1
  • 9
  • 16
59
votes
4 answers

Git merge branch into master

I have a master branch and a working branch_1. I want to 'move' branch_1 exactly as it is to master. So I want something like this: git checkout master git merge branch_1 # I don't know what is correct... Things which I did but I got loads of files…
Trt Trt
  • 5,330
  • 13
  • 53
  • 86
58
votes
3 answers

Visual Studio 2015 How to merge a branch into master?

I am new to GIT, so far I had been using Visual Studio Online TFS for my version control and I am the only developer. When I created my last project I was kind of mislead into thinking GIT was the best option for this. So I checked-in my master.…
Lord of Scripts
  • 3,579
  • 5
  • 41
  • 62
58
votes
9 answers

Telling if a Git commit is a Merge/Revert commit

I am writing a script that requires checking whether a particular commit is a Merge/Revert commit or not, and I am wondering if there is a git trick for that. What I came up with so far (and I definitely don't want to depend on the commit message…
Samer Buna
  • 8,821
  • 9
  • 38
  • 55
58
votes
4 answers

Git merge after fetch - how, exactly?

I've read from various sources that it's usually a better idea to fetch then merge rather than simply pull as it allows for finer control. That said, I've yet to find actually how to do it. Case in point: There was a small change made to some of…
Major Productions
  • 5,914
  • 13
  • 70
  • 149
57
votes
3 answers

hint: after resolving the conflicts, mark the corrected paths

git sometimes gives me this message on a conflict (during a revert or cherry pick) hint: after resolving the conflicts, mark the corrected paths What does this mean?
paullb
  • 4,293
  • 6
  • 37
  • 65
56
votes
4 answers

How to make git merge handle uncommitted changes to my working tree?

A co-worker and I are both working on the master branch at the moment. I have some code in my working tree that I don't want to commit (debugging statements and the like). Now if he commits changes to some of those same files, I can't merge…
Jeremy Huiskamp
  • 5,186
  • 5
  • 26
  • 19
56
votes
5 answers

How do I resolve a conflict after git pull?

I have to solve some conflict after a git pull. $ git pull CONFLICT (rename/add): Renamed vignette_generator_mashed.h->vision_problem_8.h in 49423dd0d47abe6d839a783b5517bdfd200a202f. vision_problem_8.h added in HEAD Added as…
Tim
  • 1
  • 141
  • 372
  • 590
55
votes
5 answers

Git rebase loses history, then why rebase?

I've been looking into rebasing with Git over the past couple days. Most of the arguments for rebasing say that it cleans up the history and makes it more linear. If you do plain merges (for example), you get a history that shows when the history…
ngephart
  • 713
  • 1
  • 5
  • 8
52
votes
2 answers

Resolve merge conflicts: Force overwrite all files

I am working on a git repository by myself (so yes, I know the implications and the warnings of doing this) and somehow one of the trees got a commit after being pushed when it shouldn't have. Now I'm trying to pull back and it's complaining about…
Qix - MONICA WAS MISTREATED
  • 14,451
  • 16
  • 82
  • 145
51
votes
2 answers

Git - Different Remote for each Branch

I'm unsure of how to ask this properly but I'll try and do my best - I'm by no means a Git aficionado, I know how to use the basic commands but not advanced terminology/functionality. I have a private repository myrepo cloned from a private server…
Craig Watson
  • 609
  • 1
  • 5
  • 7
50
votes
7 answers

git mergetool reports "No files need merging"

For some reason lately, every time I pull and get a merge conflict, running git mergetool reports "No files need merging": $ git pull First, rewinding head to replay your work on top of it... Applying: replaced home button with Cancel Using index…
Christopher Pickslay
  • 17,523
  • 6
  • 79
  • 92
50
votes
4 answers

Merging to a branch in git without switching to it

I have an application running in a git repository on a branch (say dev). The application modifies the content in some the repository and commits them. I now have to merge these changes into another branch (say master) but the snag is that I don't…
Noufal Ibrahim
  • 71,383
  • 13
  • 135
  • 169
44
votes
3 answers

Git merge flattening

If I am working in multiple branches on a single feature, I use git pull branch1 branch2 branch3 to pull all the changes into my master branch. However, all the commit logs of each branch are copied as well. How do I flatten the commit log down to a…
Verhogen
  • 27,221
  • 34
  • 90
  • 109