Home > Blockchain >  Git checkout branch from tag: got different code from that in github
Git checkout branch from tag: got different code from that in github

Time:08-06

Git checkout branch from tag: got different code from that in github.

git clone https://github.com/eclipse-ee4j/mojarra
git checkout -b mybranch 2.3.18.RELEASE

pom.xml:

<groupId>org.glassfish</groupId>
<artifactId>mojarra-parent</artifactId>
<version>4.0.0-SNAPSHOT</version>
<packaging>pom</packaging>

pom.xml file is different from the pom.xml file on github.com tag 2.3.18.RELEASE.

<groupId>org.glassfish</groupId>
<artifactId>mojarra-parent</artifactId>
<version>2.3.18</version>
<packaging>pom</packaging>

CodePudding user response:

This question seems to boil down to a typo. There is no tag 2.3.18.RELEASE - it's called 2.3.18-RELEASE (note the hypen before the RELEASE).

When you try to checkout 2.3.18.RELEASE, it will fail:

mureinik@computer ~/src/git/mojarra (master)
$ git checkout -b mybranch 2.3.18.RELEASE
fatal: '2.3.18.RELEASE' is not a commit and a branch 'mybranch' cannot be created from it

Since the checkout operation failed, you'll remain on the branch you were when you attempted the command (in the sequence described in the question, this will be master, the default branch after cloning the repo).

  • Related