i cloned mosquitto repo https://github.com/eclipse/mosquitto. contains tag v1.4.9
. not on branch.
how happen? author keep branch on own repo pushed tags branch github? or make commit tag?
i made tag local branch:
$ git checkout -b work149 v1.4.9
and looked @ last commit on branch:
$ git log -1 commit 91bfd82491f90e24b6fe9c036f0b04a1f5c14a89 merge: bf959ef 2d0af73 author: roger a. light <roger@atchoo.org> date: thu jun 2 22:05:34 2016 +0100 merge branch 'fixes'
this commit 1 more fixes
branch.
or git log --graph
can see earlier commit on same branch (not fixes
branch, branch i'm trying understand):
* | commit bf959ef9b0ae0e4d74bf80158ffb0b7c69da533d |\ \ merge: 646e0a0 5cca6b4 | |/ author: roger a. light <roger@atchoo.org> | | date: sun feb 14 14:38:42 2016 +0000 | | | | merge branch 'fixes' | |
how find out whether tag on branch , on branch? left-most vertical bar indicate branch , branch on remote?
is common practice?
from a discussion thread "git pull doesn't tags" mentions branch heads being tracked
, non-commits
. wonder whether git clone
commend puts clone not track branches on remote or repo has somehow made tags non-commits?
my guess author had branch contained 91bfd82491f, tagged commit, pushed tag, , later deleted branch. correct author may have local branch points same commit pushed tag only, not branch.
check branch or branches contain v1.4.9
using
git branch -a --contains v1.4.9
running command gives no output, confirms not on branch of own. in contrast, v1.4.8
:
$ git branch -a --contains v1.4.8 * master remotes/origin/head -> origin/master remotes/origin/debian remotes/origin/master
one way directly create tagged commit outside branch operate detached head, head
not refer named branch. in mosquitto clone, can there running
git checkout v1.4.9
which gives chatty warning.
note: checking out 'v1.4.9'. in 'detached head' state. can around, make experimental changes , commit them, , can discard commits make in state without impacting branches performing checkout. if want create new branch retain commits create, may (now or later) using -b checkout command again. example: git checkout -b <new-branch-name> head @ 91bfd82... merge branch 'fixes'
at point, git create more commits. example:
$ touch look-ma-no-branch ; git add look-ma-no-branch $ git commit -m 'look, ma! no branch!' [detached head 51a0ac2] look, ma! no branch! 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 look-ma-no-branch
this new commit 51a0ac2
not exist on branch, can confirm.
$ git branch -a --contains 51a0ac2 * (head detached v1.4.9)
for fun, let’s tag too.
git tag -a -m 'tag branchless commit' v1.4.9.1
switching master
branch git checkout master
, can use git lola
(an alias git log --graph --decorate --pretty=oneline --abbrev-commit --all
) see new tag looks similar progenitor.
$ git lola * 51a0ac2 (tag: v1.4.9.1) look, ma! no branch! * 91bfd82 (tag: v1.4.9) merge branch 'fixes' |\ | | * 1cd4092 (origin/fixes) [184] don't attempt install docs when with_docs=no. | | * 63416e6 ; | | * 5d96c3d [186] fix tls operation websockets listeners , libwebsockts 2.x. | |/ | * 2d0af73 bump version number. | | * 8ee1ad8 (origin/coverity-fixes) merge branch 'fixes' coverity-fixes [...]
confirm exists on no branch using
git branch -a --contains v1.4.9.1
because asked, no, not @ common git workflow.