1

I would just like to ask the git gurus here if this is really possible. I cloned a whole repository, then checked out branch A which tracks the repo's origin/A. I tried to build that snapshot and it got me an error. Now I was tasked to try to clone a --single-branch instead, cloning origin/A only since that was their team's workaround.

My question now is that is this possible? I checked both of the branches' (checked out branch vs cloned single branch) latest revision hash and they're the same, but I found out that when I cloned the whole repo, checked out to branch A, there exists a file but this file does not exist when I did the latter (cloned --single-branch).

What are the possible causes of this? I tried looking for the commit where the file was created using git-log but it returns blank. I tried the same command on another file and it works fine.

PS: when I cloned --single-branch A, I'm at branch A and NOT at origin/A.

Cœur
  • 37,241
  • 25
  • 195
  • 267
  • Could it be that the file you mention is created by some kind of post-checkout script? (which is not run when using the `git clone --single-branch` command?) Maybe check if the file you mention is tracked at all by git (using `git ls-tree origin/A -- path-to-folder/containing/file-in-question/` _the trailing slash is important, the result of the command might differ otherwise_) – AnimiVulpis Jul 27 '16 at 10:19
  • Alright will do. Thanks! 'Will keep you posted. – scarletlights Jul 27 '16 at 10:26
  • Okay it seems that the file is indeed not being tracked :(. Thank you! – scarletlights Jul 27 '16 at 10:31
  • I just read my comment again and I explained it a bit confusing. The `git ls-tree` should be run on the folder **containing** the file in question. For more info [git ls-tree](https://git-scm.com/docs/git-ls-tree) documentation. If the file is indeed not tracked I hope you have a new angle on the problem. – AnimiVulpis Jul 27 '16 at 10:36
  • Hi, yes, it is not tracked, unfortunately. Thanks again! It helped a lot :) – scarletlights Jul 28 '16 at 03:56
  • 1
    I think it could be a case of a [post-checkout git hook](https://git-scm.com/docs/githooks#_post_checkout) triggering in one case but not the other. So could you check the `$GIT_DIR/hooks` directory and report if you can find anything? – AnimiVulpis Jul 28 '16 at 06:56

0 Answers0