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
1
vote
0 answers

Why git changes the line order when merge conflicts occurs?

I have a base branch base with a file called base.md(for the sake of understanding, i add the line number): 1: 2: 3: b Then I check out a new branch feat and edit the base.md as below: 1: 2: 3: b 4: 5: c I add a commit feat-1. Then I go back to…
tianzhich
  • 31
  • 3
1
vote
1 answer

git merge PR of previously reverted commits (but not all the reverted commits)

I have reviewed multiple similar questions and responses that haven't worked for my situation. Most recently, "Github does not recognize…" in 2017 I have the situation that branch A -> B B (adds 100 commits) B -> C (adds 1 commit) B (adds another…
bshirley
  • 8,217
  • 1
  • 37
  • 43
1
vote
0 answers

git command to show the merge sources for %A and %B

What I want to know are the commits from which %A and %B are drawn. I am writing a merge driver that can apply domain knowledge and clean up 99% of merge conflicts in a certain set of files for which the default merge driver cannot. But conflicts…
Joshua
  • 40,822
  • 8
  • 72
  • 132
1
vote
1 answer

Merging a release branch that has a reverted merge from the main branch merges the revert into the main branch?

We develop using a main branch that has the latest developments and release branches that split off of this main branch every so often and constitute a release. Bugs are fixed on these release branches and these bugfixes are merged back to the main…
rubenvb
  • 74,642
  • 33
  • 187
  • 332
1
vote
1 answer

How do I merge a old changes into a Git repo?

I know this is a common question, but I can't find the answer I'm looking for. I have a GitHub repository that receive a few bug fixes that I merged into master. But I have 100s of change in a local folder, and I want to merge the changes with the…
1
vote
1 answer

How to merge a working branch and main branch in Git?

I have been working on a project and I'm using Git and Github for my version control. I have a main branch and a product-page branch. While I was working on product-page, I had to change something in main branch, so I made another branch nav-change…
Adarsh Dubey
  • 302
  • 2
  • 12
1
vote
1 answer

How to convert pushed regular merge into squash-merge in git?

I have accidentally merged my 20 commits using regular commit from feature branch to the main branch. Is there any way to revert it and make it as squash and merge? The purpose is to make the main branch clean. It should only have one commit for my…
achai
  • 199
  • 1
  • 7
1
vote
1 answer

Why `git merge` happens but `git log --graph` does not show the branching?

I do not understand the behavior of git merge. Sometimes, I merge a branch and, after executing git log --graph, I can see the branch merging as a draw like: D / \ C B \ / A I just did $ git merge feature1 develop Updating…
Pedro Delfino
  • 2,421
  • 1
  • 15
  • 30
1
vote
0 answers

How to work on a testing branch and in the meantime do not lose the fix you do in the master branch?

I am in this kind of situation: * 079152c (HEAD -> testing) Finished the new footer * a81cb78 created a new footer * 9c87d16 made a change to data | * a75d5cb (master) fixed matrix data | * 7b6cdd9 made another change to data |/ * aa97c17 MY NEW…
1
vote
1 answer

Can I undo a merge if I hadn't committed the code before it?

What I did: git checkout -b newbranch Made several changes to this branch. Then: git merge oldbranch None of the changes to the newbranch had been committed so I can't roll back. And now none of those changes have been applied, there's only code…
Odasaku
  • 177
  • 6
  • 17
1
vote
1 answer

error: mainline was specified but commit is not a merge; fatal: revert failed

I want to revert the reverted pull requests i.e. the 4 commits 6283c90, f665a5a, 09ed268, 05ed1bc. But when I use the command git revert -m 1 6283c90, I am running into the following error: error: mainline was specified but commit…
kkgarg
  • 1,246
  • 1
  • 12
  • 28
1
vote
1 answer

Force git to display differences between branches in editor like a merge conflict

I have two git branches I'm working on, let's call one problem-fix and the other problem-fix-dev. The dev branch is connected to a personal remote pipeline I'm working on, so I've been including all sorts of debugging and logging statements for…
1
vote
2 answers

How to merge current local branch with specific single commit from different branch in remote repository?

Lets say I have this in my local: master branch-a branch-b and I have this in my remote repository: master branch-a branch-b branch-c Conditions: I own the remote repository. I have all needed accesses. My local branch-b and remote branch-b…
Faris Han
  • 525
  • 3
  • 16
1
vote
0 answers

Why does GitHub Desktop auto-resolve conflicts?

I am not a programmer, but a game artist. I have limited knowledge on Git and Git LFS so this might be a bad question. When doing a merge, GitHub Desktop will over say it has s=resolved a conflict for me, instead of letting me choose which version…
1
vote
1 answer

Working with a Git fork's master and multiple feature branches

I am working on my personal fork of a public Git repo. I have added multiple features on separate branches in my fork (say fork/feature1 and fork/feature2), for which I have submitted separate merge requests (MRs) to the upstream repo. Now, it takes…
Alemarius Nexus
  • 340
  • 3
  • 12