Tag: merge

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 branches have new commits (bugfixes and new features). I would like to get […]

Git – how to force manual merge even if there is no conflict

This is a question which was asked many times over the years. I have found a number of answers, in particular this one: Git – how to force merge conflict and manual merge on selected file (@Dan Moulding) This page contains is a detailed guide how to set up a merge driver that would always […]

How to identify conflicting commits by hash during git rebase?

When I encounter a merge conflict using git rebase, how can I identify the source of the conflict in terms of commits, rather than just file differences? I already know how to make (basic) use of git mergetool or git add before git rebase –continue, but sometimes the differences between files just isn’t enough: I […]

git merge: Removing files I want to keep!

How can you merge two branches in git, retaining necessary files from a branch? When merging two branches, if a file was deleted in one branch and not in another, the file is ultimately deleted. For example: A file exists in master when you make a new branch you remove the file from master since […]

Making Git retain different section content between branches

I’m developing a Userscript that my employers have asked me to begin to manage via Git. Right now, I have a stable file and a beta file, so that everyone in the organization can install the stable code but can choose to help test the beta additions instead, if they want. Some portions of that […]

How do I merge changes to a single file, rather than merging commits?

I have two branches A and B and, I want to merge branch A’s single file with Branch B’s corresponding file. How can I do that?

git-svn: reset tracking for master

I’m using git-svn to work with an SVN repository. My working copies have been created using git svn clone -s http://foo.bar/myproject so that my working copy follows the default directory scheme for SVN (trunk, tags, branches). Recently I’ve been working on a branch which was created using git-svn branch myremotebranch and checked-out using git checkout […]

Git: How to create patches for a merge?

When I use git format-patch, it doesn’t seem to include merges. How can I perform a merge and then e-mail it to someone as a set of patches? For example, let’s say that I merge two branches and perform another commit on top of the merge: git init echo “initial file” > test.txt git add […]

Git: merging public and private branches while while keeping certain files intact in both branches

I’ve read a few git questions here, but could not find an answer to this one: I have a public and a private branches where I want to allow certain files to diverge. Those are configuration files with passwords and my local customizations. I do want to be able to merge the branches both ways: […]

Rebasing a Git merge commit

Take the following case: I have some work in a topic branch and now I’m ready to merge back to master: * eb3b733 3 [master] [origin/master] | * b62cae6 2 [topic] |/ * 38abeae 1 I perform the merge from master, resolve the conflicts and now I have: * 8101fe3 Merge branch ‘topic’ [master] |\ […]

Git Baby is a git and github fan, let's start git clone.