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
71
votes
2 answers

git: checkout files from another branch into current branch (don't switch HEAD to the other branch)

I want to load a different version of the files that exist in another branch into my current branch. git help checkout says: DESCRIPTION Updates files in the working tree to match the version in the index or the specified tree. If no paths are…
Kache
  • 15,647
  • 12
  • 51
  • 79
69
votes
3 answers

How to see commits that were merged in to a merge commit?

If my-feature-branch was merged into my-main-branch, how can I see what commits were merged in from my-feature-branch?
The Pixel Developer
  • 13,282
  • 10
  • 43
  • 60
69
votes
5 answers

Switching branches without touching the working tree?

I am currently on a debug branch, and would like to switch to the master branch, without modifying the working tree (leave it the way it is in the debug branch), so I can commit some of the changes into the master branch. Is there a way to do this?
static_rtti
  • 53,760
  • 47
  • 136
  • 192
69
votes
1 answer

Gitflow feature vs bugfix branch naming

While using Gitflow, what is the reason for separating branch naming to feature vs bugfix vs hotfix? I.e. why not just, for example, instead of: feature/ bugfix/ hotfix/ Just do: change/ What does separating by feature/bugfix/hotfix buy?
Pavel Chernikov
  • 2,186
  • 1
  • 20
  • 37
69
votes
5 answers

Trimming Git Commits/Squashing Git History

I check my code into a Git branch every few minutes or so, and the comments end up being things like "Everything broken starting again" and other absurdities. Then every few minutes/hours/days I do a serious commit with a real comment like, "Fixed…
Dan Rosenstark
  • 68,471
  • 58
  • 283
  • 421
69
votes
7 answers

Need to restore a deleted branch in Subversion

I have two working copies of a Subversion repository, one of the trunk, and one of a branch I created. I accidentally deleted the branch in a repository browser. How do I restore the branch? Is there a way to undo the most recent commit for the…
Luke
  • 1,345
  • 2
  • 10
  • 10
69
votes
3 answers

How can I start a clean branch with no ancestry, then commit files progressively?

I have a PHP framework versioned with GIT and I'm planning several (drastic) changes to its core. What I want to do is to start working on the new core in a new branch, but since this change might require some restructuring on the filesystem too,…
Javis
  • 843
  • 1
  • 9
  • 16
69
votes
10 answers

Subversion branch reintegration

When a branch is reintegrated to the trunk, is that branch effectively dead? Can you make modifications to the branch after the reintegration and merge those back into the trunk at a later date?
Aaron Smith
  • 3,332
  • 4
  • 29
  • 25
68
votes
6 answers

Find revision in trunk that a branch was created from

I am trying to merge the latest changes from trunk into a branch of my project, but the problem is I don't know what revision of the trunk I checked out that I eventually created the branch from. I would think SVN logged this somewhere. Does…
Andy
  • 7,885
  • 5
  • 55
  • 61
68
votes
8 answers

How to find the current git branch in detached HEAD state

I can find the current git branch name by doing either of these: git branch | awk '/^\*/ { print $2 }' git describe --contains --all HEAD But when in a detached HEAD state, such as in the post build phase in a Jenkins maven build (or in a Travis…
neu242
  • 15,796
  • 20
  • 79
  • 114
67
votes
8 answers

Switch to another branch without changing the workspace files

I cloned a git repository from GitHub, made some changes and some commits; I made quite a lot and all are quite dirty, so they're not suitable for a pull request. Now I created the branch cleanchanges from origin/master, so it's clean, and I want to…
amorfis
  • 15,390
  • 15
  • 77
  • 125
65
votes
3 answers

How to split a git branch into two branches?

I'm trying to help out a coworker who accidentally created one feature branch from another feature branch, rather than creating the second one from master. Here is essentially what we have now… Master ---A---B---C \ …
Matt V.
  • 9,703
  • 10
  • 35
  • 56
64
votes
3 answers

How to close a branch WITHOUT removing it from history in git?

I'd like to make a commit and close its branch, without removing it from history. With mercurial I'd commit --close-branch, then update to a previous one, and go on working. With git... I'm confused.
o0'.
  • 11,739
  • 19
  • 60
  • 87
63
votes
1 answer

Mercurial branching and bookmarks

I read some information about named branches and working with bookmarks. Unfortunately I still don't see a difference between them. Is there any? Is there any difference between: hg branch blah hg up blah and hg bookmark blah hg up blah ? Why…
viraptor
  • 33,322
  • 10
  • 107
  • 191
61
votes
5 answers

Fast-forward merge is not possible. To merge this request, first rebase locally

Recently, I have created newbranch and created a merge request to Master branch. Before TeamLead accept merge request into Master branch another team member was committed another fix to the same branch(newbranch). After that I committed my local…
SanjX
  • 957
  • 1
  • 8
  • 12