Questions tagged [git-branch]

git-branch is the Git command that manages branches.

git branch is the command that manages branches within a Git repository.

The default branch is called master.

To create a new branch:

git branch <branch-name>

To see a list of all branches in the current repository:

git branch

Switching to another branch:

git checkout <branch-name>

Creating a new branch and switch to it in one step:

git checkout -b <branch-name>

Deleting a branch:

git branch -d <branch-name>

Create a branch with the changes from the current branch:

git stash
git stash branch <branch-name>

More information on git-branch manual page.

3220 questions
1
vote
0 answers

why git merge operation is not showing in git log?

I'm new to git. I've done some simple operations: create a repo add an file 'A' into the local repo, then stage, commit and push to the master branch (commit1) create a branch by running git checkout -b branch_name create a new file 'B' and edit…
SKSKSKSK
  • 545
  • 1
  • 4
  • 15
1
vote
1 answer

Mistakenly made a branch from another one instead of the main line

I am new to git and accidentally created new branch from another branch instead of main. My current map: f-g / d-e / a-b-c f and g should be coming from main d-e / a-b-c \ f-g I need…
mhmd
  • 11
  • 2
1
vote
1 answer

git branch rebase common convention

I am working on a project having a master branch with some base code. Then I made a branch develop1 and committed and push to remote and requested for pull request. Okay, then I want to do another task but in-fact the pull request is not yet…
A.K.J.94
  • 492
  • 6
  • 14
1
vote
1 answer

Git not displaying pending commits from remote master branch

Sorry if this was answered somewhere else. I've looked at several threads, but to no avail :( Simple question. We have a remote master branch. A Dev has committed several changes to that remote master branch. I need to apply those to a local branch…
Leo Lagos
  • 45
  • 7
1
vote
6 answers

How do I exit my editor/pager with list of branches?

I opened a list of branches in the terminal(iTerm), and then I don't know how I can go to the current branch in the current situation. UPD: The problem is to get out of the list of these branches, that is, to close this editor
Morozov
  • 4,968
  • 6
  • 39
  • 70
1
vote
2 answers

In Git, what does it actually mean to push a local branch without tracking the corresponding remote?

I’ve read that in Git if you want to push a local branch to the remote server and make the local branch track the remote, you can use git push -u mybranch remoteserver/mybranch. I suppose that means if I use git push without the -u option then it…
1
vote
1 answer

Make my github master branch match another branch

I've been working on a forked branch "forkedBranch" and made many updates to my app. When I was happy with the updates, I went back to my master branch (git checkout master) and merged my forkedBranch (git merge forkedBranch). Unfortunately, the…
JimmyTheCode
  • 3,783
  • 7
  • 29
  • 71
1
vote
1 answer

Git: i forgot create branch master, how i can create it if my repository already has another branch?

I got an issue with my repository but i have no solution to resolve it. Please correct me. I created a repository on bitbucket, cloned it and got message "You appear to have cloned an empty repository". Next, i created new branch my-feature with…
Nhat Lich
  • 45
  • 5
1
vote
0 answers

How to update someone else's changes done in my local branch?

After sending a Pull Request with changes on my local branch (branch1), someone else pushed some more changes into my own branch (branch1). How do I update my own branch with those changes?
1
vote
0 answers

How to solve Permission denied errors after git checkout branch?

I am learning git from scratch and following some tutorial and I got this error: Yasser@pc MINGW64 ~/Documents/repos/Branching (Development) $ git checkout master Switched to branch 'master' Your branch is ahead of 'origin/master' by 1 commit. …
Yasser
  • 23
  • 3
1
vote
0 answers

In git s is possible to create a pointer to a tag that can later be moved to point to another tag?

In git, is it possible to create a pointer to a tag that can be used like a tag itself, but be moved to point to another tag at a later date? Usage: for each release that gets deployed to production, we create a tag like: release-some-identifier ,…
user10664542
  • 1,106
  • 1
  • 23
  • 43
1
vote
2 answers

How to clone specific branch and push it into another project with all history

I'm working on git in order to organize a big project that should contain two different subproject independetly each project contain 4 brachs that represent the different version of it what I want to do is to create a git repo and 8 branchs(4+4) so…
1
vote
1 answer

How to merge main and master branches?

I created a git repo about a month ago where the main branch was called 'master'. A couple days ago when I tried to commit and push to the same repo it pushed my changes to the 'master' branch, but I got a message saying the main branch has been…
Ken
  • 1,155
  • 2
  • 19
  • 36
1
vote
1 answer

git checkout master returns error when switching from mybranch

I was pushing code to master branch and switching to mybranch to fix bugs. Everything worked fine when using $git checkout master and $git checkout mybranch! The problem is that I once typed git checkout origin instead of git checkout master when I…
omegap
  • 13
  • 3
1
vote
2 answers

Git: add file to old commit being parent of a new branch already merged back?

given the following git log, how do i add a file (which never existed in any commit) to commit B, so that this new file will appear in every other commit that A? A --> B -----> D ------> F \--> C --> E --/ In my attempts with git rebase…
Gianks
  • 63
  • 1
  • 15