Questions tagged [branching-and-merging]

In version control, branches represent parallel lines of development. Merging is the action that integrates changes made in different branches.

Modern version control systems (VCS) handle branching and merging by keeping track of incremental differences in data. When a user creates a branch of a project and begins making edits to that branch, only the edits made are tracked (as opposed to the user editing a true copy of the project). When the user have finished making changes to the branch, these edits are applied in order onto the destination of the merge, branches to be made and merged at any time.

Conflicts may arise if multiple changes are made to the same data in a project. Modern VCSs will alert the user and ask them to resolve the merge conflicts (choose which changes should be kept) before completing the merge.

1503 questions
6402
votes
22 answers

Move the most recent commit(s) to a new branch with Git

How do I move my recent commits on master to a new branch, and reset master to before those commits were made? e.g. From this: master A - B - C - D - E To this: newbranch C - D - E / master A - B
Mark A. Nicolosi
  • 82,413
  • 11
  • 44
  • 46
2604
votes
16 answers

How do I safely merge a Git branch into master?

A new branch from master is created, we call it test. There are several developers who either commit to master or create other branches and later merge into master. Let's say work on test is taking several days and you want to continuously keep test…
moe
  • 28,814
  • 4
  • 19
  • 16
1321
votes
8 answers

How do I copy a version of a single file from one Git branch to another?

I've got two branches that are fully merged together. However, after the merge is done, I realise that one file has been messed up by the merge (someone else did an auto-format, gah), and it would just be easier to change to the new version in the…
madlep
  • 47,370
  • 7
  • 42
  • 53
1158
votes
11 answers

How to copy commits from one branch to another?

I've got two branches from my master: v2.1: (version 2) I've been working on for several months wss: that I created yesterday to add one specific feature to my master (in production) Is there a way to copy yesterday's commits from wss to v2.1?
Bob Walsh
  • 13,011
  • 4
  • 24
  • 21
666
votes
10 answers

How do I create a branch?

How do I create a branch in SVN?
sparkes
  • 19,343
  • 5
  • 39
  • 46
461
votes
33 answers

How to resolve git's "not something we can merge" error

I just encountered a problem when merging a branch into master in git. First, I got the branch name by running git ls-remote. Let's call that branch "branch-name". I then ran git merge branch-name command and got the following result: fatal:…
Brian
  • 14,610
  • 7
  • 35
  • 43
330
votes
4 answers

Find unmerged Git branches?

I have a Git repository with many branches, some of them already merged and some not. Since the number of branches is quite large, how can I determine which branches have not yet been merged? I would like to avoid having to do an "octopus" merge and…
fluca1978
  • 3,968
  • 2
  • 15
  • 15
186
votes
7 answers

Remove large .pack file created by git

I checked a load of files in to a branch and merged and then had to remove them and now I'm left with a large .pack file that I don't know how to get rid of. I deleted all the files using git rm -rf xxxxxx and I also ran the --cached option as…
user1116573
  • 2,817
  • 4
  • 17
  • 27
172
votes
6 answers

git cherry-pick not working

I'm trying to cherry-pick a commit from master and get it into the current production branch. However, when I execute git cherry-pick , I just get this message: # On branch prod_20110801 # Untracked files: # (use "git add ..." to…
Jay Taylor
  • 13,185
  • 11
  • 60
  • 85
164
votes
3 answers

How do you branch and merge with TortoiseSVN?

How do you branch and merge with Apache Subversion using the TortoiseSVN client?
cmcculloh
  • 47,596
  • 40
  • 105
  • 130
156
votes
4 answers

Should I delete a branch after merging it?

After merging a branch, do you delete it from the repository? Is it a good practice or not? I usually create a lot of branches, since I don't want to break my current release, and I'd wish to delete them to keep things in order. However, if you work…
tampe125
  • 8,231
  • 7
  • 30
  • 45
155
votes
3 answers

Why am I merging "remote-tracking branch 'origin/develop' into develop"?

I'm the only one in my organization who's making commits with the following message: Merge remote-tracking branch 'origin/develop' into develop Not sure what I'm doing to cause them, but I'd like to stop. What command am I issuing to create this…
Jordan Warbelow-Feldstein
  • 10,510
  • 12
  • 48
  • 79
148
votes
12 answers

How do you maintain development code and production code?

What are the best practices and rules-of-thumb to follow while maintaining code? Is it good practice to have only the production ready code in the development branch, or should untested latest code be available in the development branch? How do you…
110
votes
11 answers

What I can do to resolve "1 commit behind master"?

After pushing I've been seeing this message at remote repository: 1 commit behind master. This merge has conflicts that must be resolved before it can be committed. To manually merge these changes into TA20footerLast run the following commands: git…
103
votes
1 answer

TFS: Updating branch with changes from main

So, we have our main dev line, I create a branch, and developer b creates a branch. We both do some work. developer b finishes his work, merges back into the main dev line. I know his changes will affect me, and rather than deal with the…
CaffGeek
  • 21,856
  • 17
  • 100
  • 184
1
2 3
99 100