Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "Warning : There are multiple branch changesets here" mean?

Tags:

git

jenkins

We use Jenkins as our CI-engine, which knows how to monitor a git repository. For some reason I usually see

Started by user anonymous
Building in workspace /var/lib/jenkins/jobs/X/workspace
Checkout:workspace / /var/lib/jenkins/jobs/X/workspace - hudson.remoting.LocalChannel@844d88
Using strategy: Default
Last Built Revision: Revision 8422864a9745535d808435bd33ece764fd250358 (origin/HEAD, origin/master)
Fetching changes from 1 remote Git repository
Fetching upstream changes from gitosis@...
Seen branch in repository origin/HEAD
Seen branch in repository origin/master
Commencing build of Revision c1e71af117df3cd63da972f361ad260af6f16bf5 (origin/HEAD, origin/master)
Checking out Revision c1e71af117df3cd63da972f361ad260af6f16bf5 (origin/HEAD, origin/master)
Warning : There are multiple branch changesets here
Parsing POMs
Modules changed, recalculating dependency graph

My question is, what does the "Warning : There are multiple branch changesets here" line actually_mean_?

like image 259
Thorbjørn Ravn Andersen Avatar asked Feb 19 '13 15:02

Thorbjørn Ravn Andersen


People also ask

Can I have multiple branches in git?

Git offers a feature referred to as a worktree, and what it does is allow you to have multiple branches running at the same time. It does this by creating a new directory for you with a copy of your git repository that is synced between the two directories where they are stored.

What does changeset mean in git?

Indivisible simply means that a changeset is one single value in the stack of changes that are being made on a codebase. For example, if you look at a commit, you can check what individual files were modified, what was the previous state of the codebase and after, which would make it adhere to what a changeset is.

How do I push changes to all branches?

If you use git branches a lot, you'll often push each branch after each commit. Instead of pushing every single branch you can do git push --all origin . This will push all commits of all branches to origin.


1 Answers

I'm no Jenkins expert but I found this issue that would seem to explain the warning:

https://issues.jenkins-ci.org/browse/JENKINS-6856

It seems Jenkins builds in detached head state and that happens when it checkouts a remote branch (origin/master in this case) and I'm guessing that the warning is due to HEAD not pointing to a local branch. So Jenkins has created an anonymous branch in effect.

EDIT: Did a code search on Github and found the methods in the GitSCM plugin for Jenkins that generate this warning. See here

If a revision (which you can see in another Jenkins plugin called git-client-plugin), has more than one branch pointing to it then the GitSCM plugin warns that there are multiple branches. The revision is the git commit that is being built and it is fully possible in git to have multiple branches pointing to the same commit.

The comment for the Revision class explains it:

A Revision is a SHA1 in the object tree, and the collection of branches that share this ID. Unlike other SCMs, git can have >1 branches point at the same commit.

like image 181
Daniel Lee Avatar answered Oct 09 '22 11:10

Daniel Lee