branch

GIT: How to unambiguously reference current HEAD when having a branch called HEAD?

匆匆过客 提交于 2019-11-29 09:42:24
Even though "HEAD" is definitely a poor choice for the name of a Git branch, it is still a valid branch name. If you happen to have branch named "HEAD", is there a way how to unambiguously refer to the actual HEAD symbolic reference? The branch can be referenced as refs/heads/HEAD , but what about the HEAD itself? Using just HEAD results in an refname 'HEAD' is ambiguous error anywhere where a <commit> is passed as an argument. According to gitrevisions , if both HEAD and refs/heads/HEAD exist, the selected revision is HEAD (i.e., not the branch named HEAD ). This is in fact the correct answer

How to get information where branch starts?

六月ゝ 毕业季﹏ 提交于 2019-11-29 09:40:19
问题 As far as I know, commit object contains information only about parents, so if I have situation something like this: * branch-1 | o | o master | o which is some kind of equivalent of * branch-1 | o / o master | o but what if my master will go forward? o master | o * branch-1 | | o o |/ o | o being on branch-1, git log --graph --decorate will show me only: * branch-1 | o | o | o if I know from which branch I was started, I can call git merge-base master branch-1 , but what if I don't know from

git cherry-pick to another branch

不打扰是莪最后的温柔 提交于 2019-11-29 09:09:34
I wonder if there is the way to copy one commit to another branch without checking out that branch. For example, I have two branches: master and parallel_version . I'm on parallel_version branch and I found a bug in file common for these branches. I've fixed it and committed. How to duplicate this commit to another branch, assuming I'm using git-svn? Normally I would do: $ git checkout master $ git cherry-pick parallel_version $ git checkout parallel_version Is there better way of doing that? That's not possible - simply imagine what would happen if there was a conflict that couldn't be

Pros and cons of different branching models in DVCS

独自空忆成欢 提交于 2019-11-29 07:49:46
问题 The Big Three of distributed version control (Git, Bazaar, and Mercurial) each treat branching fairly differently. In Bazaar, for example, branches are separate repos (actually, divergent copies of the parent repo); on your file system, different branches live in different directories. In Git, on the other hand, you can have multiple branches existing in the same repo (and therefore in the same directory on your file system). Mercurial supports both behaviors, the latter with named branches.

Deleting a remote branch

心不动则不痛 提交于 2019-11-29 07:38:01
When I perform branch -a : $ git branch -a * master remotes/origin/HEAD -> origin/master remotes/origin/hello remotes/origin/master And then I remove the branch: $ git branch -r -D origin/hello Deleted remote branch origin/hello (was c0cbfd0). Now I see: $ git branch -a * master remotes/origin/HEAD -> origin/master remotes/origin/master The branch "hello" has been removed. But when I fetch: $ git fetch From localhost:project * [new hello] hello -> origin/hello $ git branch -a * master remotes/origin/HEAD -> origin/master remotes/origin/hello remotes/origin/master I'm so confused. I think it

How to allow per user protected branches access in GitLab?

时光毁灭记忆、已成空白 提交于 2019-11-29 07:27:47
GitLab allow me create protected branches and then specified witch users will have push access to those protected branches. But what about if I want some users access to some, but not all protected branches on the same repo? I mean, a more discrete/granulated user-branch permissions. Steven V Those types of permissions do not exist in GitLab. As an alternative approach: you can make the user unable to commit to the main repository and then use the Project forking workflow allowing them to fork the repository to their own namespace which they can do their work on and then submit a pull request.

When is the reintegrate option really necessary?

梦想的初衷 提交于 2019-11-29 07:12:03
问题 If you always synchronise a feature branch before you merge it back. Why do you really have to use the --reintegrate option? The Subversion book says: When merging your branch back to the trunk, however, the underlying mathematics is quite different. Your feature branch is now a mishmosh of both duplicated trunk changes and private branch changes, so there's no simple contiguous range of revisions to copy over. By specifying the --reintegrate option, you're asking Subversion to carefully

Is it possible with Git to retrieve a list of tags that exist only in a certain branch?

拈花ヽ惹草 提交于 2019-11-29 07:09:23
I would like to know if it's possible in Git to retrieve a list of tags (much like the result of the git tag command), but the list should be limited only to a certain branch. If this is possible, can anyone explain how this is done? Perhaps with some pattern-matching magic? Another approach would be possible with the new git tag options --merged (in git 2.7+, Q4 2015) git tag --merged <abranchname> See commit 5242860 , ... (10 Sept 2015) by Karthik Nayak ( KarthikNayak ) . (Merged by Junio C Hamano -- gitster -- in commit 8a54523 , 05 Oct 2015) tag.c: implement '--merged' and '--no-merged'

pull-only repo's 'git status' saying the branch is ahead of origin/master. Why?

本秂侑毒 提交于 2019-11-29 06:31:40
So here's the situation: $ git status # On branch master # Your branch is ahead of 'origin/master' by [x] commits. # There are several questions about this on SO already, but none seem to specifically address the type of scenario I have. This answer to one of the questions comes closest, but doesn't go into detail. I'll just quote it verbatim: If you get this message after doing a "git pull remote branch", try following it up with a "git fetch". Fetch seems to update the local representation of the remote branch, which doesn't necessarily happen when you do a "git pull remote branch". That tip

git查看切换分支

最后都变了- 提交于 2019-11-29 05:35:26
Git 一般有很多分支,我们clone到本地的时候一般都是master分支,那么如何切换到其他分支呢?主要命令如下: 1. 查看远程分支 $ git branch -a 我在mxnet根目录下运行以上命令: ~/mxnet$ git branch -a * master remotes/origin/HEAD -> origin/master remotes/origin/master remotes/origin/nnvm remotes/origin/piiswrong-patch-1 remotes/origin/v0.9rc1 可以看到,我们现在在master分支下 2. 查看本地分支 ~/mxnet$ git branch * master 3. 切换分支 $ git checkout -b v0.9rc1 origin/v0.9rc1 Branch v0.9rc1 set up to track remote branch v0.9rc1 from origin. Switched to a new branch 'v0.9rc1' #已经切换到v0.9rc1分支了 $ git branch master * v0.9rc1 #切换回master分支 $ git checkout master Switched to branch 'master' Your