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.

1377 questions
5491
votes
15 answers

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

I'd like to move the last several commits I've committed to master to a new branch and take master back to before those commits were made. Unfortunately, my Git-fu is not strong enough yet, any help? I.e. How can I go from this master A - B - C - D…
Mark A. Nicolosi
  • 72,599
  • 10
  • 41
  • 46
2325
votes
14 answers

What is the best (and safest) way to 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
  • 25,936
  • 3
  • 17
  • 16
1071
votes
7 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
  • 41,172
  • 7
  • 39
  • 53
849
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
  • 9,881
  • 4
  • 22
  • 19
638
votes
10 answers

How do I create a branch?

How do I create a branch in SVN?
sparkes
  • 18,823
  • 5
  • 36
  • 45
331
votes
27 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
  • 11,132
  • 7
  • 32
  • 43
301
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,668
  • 2
  • 13
  • 15
162
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
  • 43,791
  • 36
  • 94
  • 126
139
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…
137
votes
2 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 Feldstein
  • 9,671
  • 9
  • 44
  • 78
129
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,187
  • 4
  • 15
  • 27
125
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
  • 11,805
  • 11
  • 55
  • 83
107
votes
4 answers

Should I delete a branch after merging it?

After merging a branch, do you delete it from the repository? However, it's 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,…
tampe125
  • 6,831
  • 7
  • 26
  • 44
102
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
  • 20,889
  • 16
  • 95
  • 176
91
votes
7 answers

Deleting an SVN branch

I created a branch of an SVN project called 'features', and now whenever I try to update said project, it brings with it a features folder, which contains another copy of the project from the branch. Is there a way to remove the branch from the…
GSto
  • 38,666
  • 37
  • 126
  • 179
1
2 3
91 92