Tag: merge

Moving Git repository content to another repository preserving history

I am trying to move only the contents of one repository (say repo1) to another existing repository (say repo2) using the following commands; git clone repo1 git clone repo2 cd repo1 git remote rm origin git remote add repo1 git push But its not working. I reviewed the other similar post but i only found […]

git rebase interactive: squash merge commits together

I wanted to have a simple solution to squash two merge commits together during an interactive rebase. My repository looks like: X — Y ——— M1 ——– M2 (my-feature) / / / / / / a — b — c — d — e — f (stable) That is, I have a my-feature branch that […]

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 made. What I want now is a new branch where I have iphone and current master […]

Really flatten a git merge

There’re few question about “flattening merge” on StackOverflow, with an answer usually being “git rebase“. These answers though miss one crucial point – order of commits. Suppose there’s a branch A with commits of Jun 1 and Aug 1, and branch B with commit of Jul 1 (UPDATE to reinstate the usecase described below: branches […]

git subtree: possible to change subtree branch/path in a forked repository?

In a repository A the folder sub is included as git subtree of the repository S – pointing to master branch. I have forked repository A into F. Now I want to do one of the following in F: change sub to use a different branch of S (ie develop branch) or: change sub to […]

How do I make git merge's default be –no-ff –no-commit?

Company policy is to use –no-ff for merge commits. I personally like to adjust merge log messages so I use –no-commit. Plus I like to actually compile and test before I let the commit go. How do I make –no-ff and –no-commit the default for me for all branches? (and I’ve learned in the years […]

How can I discard remote changes and mark a file as “resolved”?

I have some local files, I pull from remote branch and there are conflicts. I know that I would like to keep my local changes and ignore the remote changes causing conflicts. Is there a command I can use to in effect say “mark all conflicts as resolved, use local”?

How to handle xml/html in git feature branch workflow?

Our project is working within fairly close quarters code-wise (a lot of changes happening in parallel in a fairly small geographical area of the code), and our feature branch based git workflow works out really nice for our java code. But the xml/html stuff is not working really well. Simple unrelated changes (a designer adding […]

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 […]

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