Rohit Sarkar
Rohit Sarkar

Reputation: 129

Why am I getting another Commit Id in output?

I am executing

git branch --contains d54ede4e40364def648b30f7a8c567e1240c1225

this git command it should give me the branch name for the specified commit Id only as per my knowledge.

The output I am getting is

  79d86199fb35cd88829551857057e3729fddcb83
* master

Can anyone tell be why I am getting a different Commit Id in the output.

In some case for some different commit ID I am getting output as below

warning: refname '79d86199fb35cd88829551857057e3729fddcb83' is ambiguous.
Git normally never creates a ref that ends with 40 hex characters
because it will be ignored when you just specify 40-hex. These refs
may be created by mistake. For example,

  git checkout -b $br $(git rev-parse ...)

where "$br" is somehow empty and a 40-hex ref is created. Please
examine these refs and maybe delete them. Turn this message off by
running "git config advice.objectNameWarning false"
  79d86199fb35cd88829551857057e3729fddcb83
* master

Can anyone explain me why I am getting this type of outputs.

git branch -v
  79d86199fb35cd88829551857057e3729fddcb83 79d8619 Git Check file ***
* master                                   8ca4c06 Multiple files

Upvotes: 1

Views: 100

Answers (1)

julian
julian

Reputation: 471

git branch --contains will return the branches that contain the named commit (in other words, the branches whose tip commits are descendants of the named commit)

In your case that are two branches, master and a branch named 79d86199fb35cd88829551857057e3729fddcb83 which I assume you created by mistake?

Upvotes: 3

Related Questions