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

How to deal with main and master in Github

I have opened a Git repository with readme file in Github, and then use below to push local code to this repository git push origin master It shows two branchs: main and master, but with git branch, it only shows main branch $ git branch *…
Annie
  • 85
  • 3
  • 14
1
vote
1 answer

How do I merge one git feature branch into another one?

Our project has a Git develop branch and each developer is working on a specific feature branch that was created from that branch at some point. So let's say I have the feature1 branch and the feature2 branch, and I need in feature2 some changes…
1
vote
0 answers

I want to undo a merge with master locally, but it gives me a fatal error

I had a local branch that was older, so I wanted to update it with changes from the remote master while keeping the local changes I had made to it. So I did this: git checkout master git pull master git checkout my_local_branch git merge master This…
SkyeBoniwell
  • 6,345
  • 12
  • 81
  • 185
1
vote
1 answer

Keeping changes same in merging branches in

I have been using Git for a while and I know basics of merging, tho I have one confusion on how others maintain the code changes after merging? I have master branch, and feature_a branch which is created from master. There are some changes in master…
Darshan
  • 515
  • 1
  • 3
  • 16
1
vote
0 answers

Disallow Git merge from combining separated merge conflict rows into one big merge conflict

I'm trying to do union merge to a file which contains simple javascript objects. However, I noticed that git merge seems to be "combining" multiple merge conflicts into a single merge conflict if it results into same or lower amount of rows. This…
Myzel
  • 21
  • 2
1
vote
0 answers

How to merge Feature, Develop and Main without leaving branches ahead/behind (github)

We have an issue that whenever we merge into main, develop and main continue to be out of sync. We have: Main - production Develop stage Feature branches (temporary) At the start of this, Main and Develop are completely matching (no ahead or…
iamonkey
  • 121
  • 1
  • 4
1
vote
0 answers

Git script to replicate code across multiple branches

Due to constraints of Jenkins, we need to maintain multiple branches (with different branch names), across our repository. - development - main - bvt - unit-tests All of these should contain the same code, but as we are using Jenkinsfile to run the…
gagneet
  • 35,729
  • 29
  • 78
  • 113
1
vote
1 answer

Force Git to always choose the newer version of specific file during a merge? Or commit to only specific branch?

I am a single developer for my project. In development I use one file buildnumber.txt which I need to have always the latest, despite the branch. Given a merge command: git merge featureBranch --no-ff Can I specify somewhere that in case of file…
1
vote
2 answers

git flow: merging back to master which is different now

I have this question. Imagine I have 5 files on master Imagine I make a new branch from master test I go back to master, make commit which deletes one file again make another commit which deletes one file, again make commit which deletes file Now,…
user15100895
1
vote
2 answers

How to resolve a conflict locally without actually merging the pull request

I currently have a branch that is in a pull request back into the master branch. There is a conflict with a couple of git markers that I would like to delete. But I do not want to continue with the merging, since I am waiting for a review on my pull…
SDG
  • 2,260
  • 8
  • 35
  • 77
1
vote
1 answer

Git merge creating conflicts when it shouldn't

We have two branches: master and dev. Our ci deploys to production upon a merge into master. Now, we do our development in dev and intend to merge to master when we wish to deploy. We do not do development in master. When we open pull requests to…
melchoir55
  • 6,842
  • 7
  • 60
  • 106
1
vote
1 answer

Missing line in git repo

Something weird happened to my git repo. As you can see from the following diff, at first we added console.log(config), in the next commit we removed it and in the last we removed it again because that line was still present on the repo. How's that…
mirobertod
  • 360
  • 2
  • 12
1
vote
1 answer

git merge issues - force merge

I have two branches in git. Branch dev and my feature branch 1300. Branch 1300 is a complete refactoring of branch dev. Now I'm finished with 1300 and want to merge it into the dev branch. How can I do a merge force 1300 into dev. When I do a normal…
Felix
  • 5,452
  • 12
  • 68
  • 163
1
vote
1 answer

Retrieve list of features from develop(s) concerned by a build on release branch

We are interested of making a script that simplify our building process. For that, we need to list the Git features that were merged onto one or more develop branches, since our last build. I made this quick example, sorry for lack of design. Let's…
Retsim
  • 433
  • 1
  • 5
  • 19
1
vote
0 answers

How to squash commits that contain merge commits without re-resolving conflicts?

I've been working on a long running branch and I've been pulling another branch (develop) into my branch every so often. I've also been making small WIP (Work in Progress) commits as I go along. I'd like to rebase/squash all the WIP commits…
jonathanbell
  • 2,507
  • 5
  • 23
  • 40