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
429
votes
7 answers

How can I search Git branches for a file or directory?

In Git, how could I search for a file or directory by path across a number of branches? I've written something in a branch, but I don't remember which one. Now I need to find it. Clarification: I'm looking for a file which I created on one of my…
Peeja
  • 13,683
  • 11
  • 58
  • 77
414
votes
16 answers

Switch branch and ignore any changes without committing

I was working on a git branch and was ready to commit my changes, so I made a commit with a useful commit message. I then absentmindedly made minor changes to the code that are not worth keeping. I now want to change branches, but git gives…
Daniel Farrell
  • 9,316
  • 8
  • 39
  • 62
409
votes
18 answers

Renaming a branch in GitHub

I just renamed my local branch using git branch -m oldname newname but this only renames the local version of the branch. How can I rename the one on GitHub?
enchance
  • 29,075
  • 35
  • 87
  • 127
395
votes
10 answers

In git, is there a simple way of introducing an unrelated branch to a repository?

While helping a friend with a git problem today, I had to introduce a branch that needed to be totally separate from the master branch. The contents of this branch really had a different origin from what had been developed on the master branch, but…
hillu
  • 9,423
  • 4
  • 26
  • 30
370
votes
8 answers

Why do I have to "git push --set-upstream origin "?

I created a local branch for testing Solaris and Sun Studio. I then pushed the branch upstream. After committing a change and attempting to push the changes: $ git commit blake2.cpp -m "Add workaround for missing _mm_set_epi64x" [solaris 7ad22ff]…
jww
  • 97,681
  • 90
  • 411
  • 885
353
votes
17 answers

Get all files that have been modified in git branch

Is there a way to see what files have changed in a branch?
Raif
  • 8,641
  • 13
  • 45
  • 56
347
votes
5 answers

Which characters are illegal within a branch name?

Which characters are illegal within a branch name?
lunohodov
  • 5,179
  • 2
  • 25
  • 17
346
votes
4 answers

Forking vs. Branching in GitHub

I'd like to know more about the advantages and disadvantages of forking a github project vs. creating a branch of a github project. Forking makes my version of the project more isolated from the original one because I don't have to be on the…
reprogrammer
  • 14,298
  • 16
  • 57
  • 93
345
votes
16 answers

Branch descriptions in Git

Is there a way in Git to have a 'description' for branches? While I try to use descriptive names, working for a while on a single branch sometimes dampens my memory of why I made some of the other topic branches. I try to use descriptive names for…
Noufal Ibrahim
  • 71,383
  • 13
  • 135
  • 169
342
votes
8 answers

Git merge errors

I have a git branch called 9-sign-in-out with perfectly working code, and I want to turn it into the master. I'm currently on the master branch. $ git branch 9-sign-in-out * master I'm trying to switch to 9-sign-in-out branch, but it doesn't allow…
Sayanee
  • 4,957
  • 4
  • 29
  • 35
316
votes
5 answers

Git: Merge a Remote branch locally

I've pulled all remote branches via git fetch --all. I can see the branch I'd like to merge via git branch -a as remotes/origin/branchname. Problem is it is not accessible. I can't merge or checkout.
micahblu
  • 4,924
  • 5
  • 27
  • 33
312
votes
4 answers

Difference between git checkout --track origin/branch and git checkout -b branch origin/branch

Does anybody know the difference between these two commands to switch and track a remote branch? git checkout -b branch origin/branch git checkout --track origin/branch I think both keep track of the remote branch so I can push my changes to the…
yorch
  • 7,170
  • 8
  • 32
  • 38
297
votes
8 answers

Using Git, how could I search for a string across all branches?

Using Git, how could I search within all files in all local branches for a given string? GitHub specific: is it possible to perform the above search across all GitHub branches? (There are several remote branches on my remote GitHub repository that…
Ivar
  • 5,102
  • 2
  • 31
  • 43
294
votes
8 answers

Using the slash character in Git branch name

I'm pretty sure I saw somewhere in a popular Git project the branches had a pattern like "feature/xyz". However when I try to create a branch with the slash character, I get an error: $ git branch labs/feature error: unable to resolve reference…
user58777
292
votes
5 answers

Can I make fast forwarding be off by default in git?

I can't really ever think of a time when I would use git merge rather than git rebase and not want to have a commit show up. Is there any way to configure git to have fast forwarding off by default? The fact that there's an --ff option would seem…
Jason Baker
  • 192,085
  • 135
  • 376
  • 510