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
81
votes
1 answer

What are the differences between `--squash` and `--no-ff --no-commit`?

Which one should one use to hide microcommits? Is the only difference between git merge --squash and git merge --no-ff --no-commit the denial of the other parents?
Tobias Kienzler
  • 25,759
  • 22
  • 127
  • 221
80
votes
5 answers

git: merge two branches: what direction?

We have the following situation: A --- B --- C --- ... --- iphone / ... --- last-working --- ... --- master Between last-working and iPhone, 32 commits were made. Between last-working and master, a lot of commits were…
Albert
  • 65,406
  • 61
  • 242
  • 386
79
votes
11 answers

How to create a GitLab merge request via command line

We are working on integrating GitLab (enterprise edition) in our tooling, but one thing that is still on our wishlist is to create a merge request in GitLab via a command line (or batchfile or similar, for that matter). We would like to integrate…
patrick
  • 793
  • 1
  • 5
  • 4
79
votes
4 answers

Git merge doesn't use default merge message, opens editor with default message

How can I force git merge to use the default merge message instead of loading my editor with said message? I have no editor listed in git config -l, so I'm not sure why it opens an editor.
kjb
  • 3,035
  • 3
  • 23
  • 30
72
votes
1 answer

Why does the same conflict reappear when I use git rebase?

I have read relevant questions about git merge and git rebase on SO, but I still cannot fully understand what is happening under the hood. Here is our branching situation: MASTER------------------------ \ \ \ …
NeoWang
  • 17,361
  • 24
  • 78
  • 126
72
votes
3 answers

When to use the '--no-ff' merge option in Git

A Successful Git Branching Model recommends to use --no-ff when merging branches: The --no-ff flag causes the merge to always create a new commit object, even if the merge could be performed with a fast-forward. This avoids losing information…
leifericf
  • 2,324
  • 3
  • 26
  • 37
72
votes
2 answers

Git pull - can't submit merge message

Possible Duplicate: github locks up mac terminal when using pull command I am using Git via the terminal on the mac. I have encountered an annoying problem recently when I try to perform git pull. After performing git pull I receive the following…
Daan
  • 1,663
  • 1
  • 15
  • 13
69
votes
3 answers

How to see commits that were merged in to a merge commit?

If my-feature-branch was merged into my-main-branch, how can I see what commits were merged in from my-feature-branch?
The Pixel Developer
  • 13,282
  • 10
  • 43
  • 60
69
votes
4 answers

How to checkout merge request locally, and create new local branch?

I have GitLab repository there and I need to test every merge request locally, before merging to the target branch. How can I pull/fetch merge request as a new branch?
Lokinder Singh Chauhan
  • 2,326
  • 1
  • 20
  • 23
67
votes
2 answers

git log the difference between 1 branch from another

I have 2 branches A and B. Whenever I run a build, Branch A gets merged into Branch B. I want to be able to email out all the updates made in A, since the last time the build was ran. How can I use git log to be able to copy all the commits made in…
Adam Johnson
  • 2,198
  • 1
  • 17
  • 23
66
votes
5 answers

Removing/undoing a merge on Sourcetree

I made quite few changes in my project (I was working on a remote branch and not the master), I committed them and created a pull request on BitBucket and merged the branch to master. I had forgotten to push my changes after the commit. Now, after…
Rameez Hussain
  • 6,414
  • 10
  • 56
  • 85
64
votes
6 answers

Android Studio Update Project: Merge vs Rebase vs Branch Default

Apologies if this seems redundant as I know there are fair amount of questions regarding Merge vs Rebase, but there doesn't seem to be any that throw in 'Branch Default' as well. You are given a case where you have multiple people working on…
Kurt Wagner
  • 3,295
  • 13
  • 44
  • 71
60
votes
2 answers

git: why can't I delete my branch after a squash merge?

I have a git repo with mainline (equivalent to master) and some local feature branches. For example: $ git branch * mainline feature1 feature2 feature3 When I do the following, I am able to squash merge all of my edits in a feature branch…
user1002119
  • 3,692
  • 4
  • 27
  • 30
60
votes
6 answers

Git pull asks me to write merge message

I pull from my branch: git checkout mybranchSample git fetch git pull origin master Then, Git gives me the following message: Please enter a commit message to explain why this merge is necessary, especially if it merges an updated upstream into…
Pratik Joshi
  • 11,485
  • 7
  • 41
  • 73
60
votes
3 answers

List all modified files in git merge commit - even the fast forwarded

I'm thinking if there is a way that when I merge a branch into another branch that ALL changed files are listed in my commit message and not just the ones which were modified in both branches. This would give me a better overview of what was changed…
soupdiver
  • 3,504
  • 9
  • 40
  • 68