Questions tagged [branch]

A "branch" is a term used in version control systems to represent an independent line of development. Depending on the system, a repository can contain one or more branches. Branches are merged when changes need to propagate from one branch into another.

A "branch" is a term used in version control systems to represent an independent line of development. Depending on the system, a repository can contain one or more branches. Branches are merged when changes need to propagate from one branch into another.

Source: Wikipedia Branch (Version Control)

Related tags:

5403 questions
292
votes
11 answers

How to download a branch with git?

I have a project hosted on GitHub. I created a branch on one computer, then pushed my changes to GitHub with: git push origin branch-name Now I am on a different computer, and I want to download that branch. So I tried: git pull origin…
Andrew
  • 227,796
  • 193
  • 515
  • 708
288
votes
5 answers

How to merge remote master to local branch

I have a local branch of a project ("configUpdate") that I've forked from somebody else's project and I've done a load of changes on it and would like to merge the changes they've made in to my local branch. I've tried git pull --rebase origin…
Martyn
  • 16,432
  • 24
  • 71
  • 104
287
votes
10 answers

How to get the changes on a branch in Git

What is the best way to get a log of commits on a branch since the time it was branched from the current branch? My solution so far is: git log $(git merge-base HEAD branch)..branch The documentation for git-diff indicates that git diff A...B is…
Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
261
votes
33 answers

Can't push to remote branch, cannot be resolved to branch

I migrated my repos from Bitbucket or Github. I don't think this matters but it's the only thing different. For a little while, I had two remotes set up: origin: bitbucket github: github Then I removed both and pointed origin to github: git remote…
jleach
  • 7,410
  • 3
  • 33
  • 60
261
votes
5 answers

Git: copy all files in a directory from another branch

How do I copy all files in a directory from another branch? I can list all of the files in that directory by doing git ls-tree master:dirname I can then copy all of the files individually by doing git checkout master -- dirname/filename However,…
alexenko
  • 2,913
  • 2
  • 18
  • 10
258
votes
3 answers

How do I delete a Git branch with TortoiseGit

Is there an option to delete a branch with TortoiseGit? I found a solution for the commandline. Is there an implementation in TortoiseGit?
Tarion
  • 16,283
  • 13
  • 71
  • 107
255
votes
10 answers

Git: "Not currently on any branch." Is there an easy way to get back on a branch, while keeping the changes?

So I've done some work in the repository and when I'm about to commit I realize that I'm not currently on any branch. This happens a lot when working with submodules and I am able to solve it, but the process is tedious and I've been thinking that…
Erik B
  • 40,889
  • 25
  • 119
  • 135
255
votes
8 answers

Prevent pushing to master on GitHub?

GitHub allows you to configure your repository so that users can't force push to master, but is there a way to prevent pushing to master entirely? I'm hoping to make it so that the only way of adding to commits to master is through the GitHub pull…
joshlf
  • 21,822
  • 11
  • 69
  • 96
254
votes
7 answers

Mercurial — revert back to old version and continue from there

I'm using Mercurial locally for a project (it's the only repo there's no pushing/pulling to/from anywhere else). To date it's got a linear history. However, the current thing I'm working on I've now realized is a terrible approach and I want to go…
Paolo
  • 22,188
  • 6
  • 42
  • 49
248
votes
6 answers

What is a tracking branch?

Can someone explain a "tracking branch" as it applies to git? Here's the definition from git-scm.com: A 'tracking branch' in Git is a local branch that is connected to a remote branch. When you push and pull on that branch, it automatically…
jerhinesmith
  • 15,214
  • 17
  • 62
  • 89
243
votes
4 answers

How to correctly close a feature branch in Mercurial?

I've finished working on a feature branch feature-x. I want to merge results back to the default branch and close feature-x in order to get rid of it in the output of hg branches. I came up with the following scenario, but it has some issues: $ hg…
Andrey Vlasovskikh
  • 16,489
  • 7
  • 44
  • 62
242
votes
9 answers

What is trunk, branch and tag in Subversion?

Possible Duplicate: What do “branch”, “tag” and “trunk” really mean? What is a trunk, branch and tag in Subversion and what are the best practices to use them? What tools can I use for Subversion in Visual Studio 2008?
Hemanshu Bhojak
  • 16,972
  • 16
  • 49
  • 64
239
votes
8 answers

How do I create a new GitHub repo from a branch in an existing repo?

I have master and new-project branches. And now I'd like to create a brand new repo with its master based on the new-project branch. Background: I have one repository which contains three independent applications. It didn't start out this way. There…
Dogweather
  • 15,512
  • 17
  • 62
  • 81
236
votes
3 answers

Does deleting a branch in git remove it from the history?

Coming from svn, just starting to become familiar with git. When a branch is deleted in git, is it removed from the history? In svn, you can easily recover a branch by reverting the delete operation (reverse merge). Like all deletes in svn, the…
Ken Liu
  • 22,503
  • 19
  • 75
  • 98
234
votes
6 answers

git working on two branches simultaneously

I have a project with many branches. I would like to work on several branches simultaneously without switching back and forth with git checkout. Is there any way I can do that besides copying the whole repository somewhere else?
name
  • 5,095
  • 5
  • 27
  • 36