question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Only a single (grafted) commit left in branch after checkout with extension?

See original GitHub issue
  • Extension version: 0.5.0
  • VSCode Version: 1.32.1
  • OS: Windows 10 64-bit

Steps to Reproduce:

Unclear. I tried to reproduce the problem with a simplified setup, but to no avail. Here is a list of things I remember:

  • Had accidentally staged all changed/untracked files
  • Unstaged them one by one by clicking the - button on them in source code management sidebar in quick succession (in parallel? it tooks quite a while until it finished in the background)
  • Installed GitHub extension
  • The working copy had branch devel checked out, potentially not up-to-date with remote
  • I wanted to edit something a feature branch call documentation/graph-traversal-build-fix
  • There was already a local branch with that name, but it was behind the remote branch (same name)
    • I had merged origin/devel into documentation/graph-traversal-build-fix on a different machine
    • My local branch was behind but that merge commit
  • Via the GitHub extension, I located the corresponding PR for that branch and clicked the Checkout button
  • When I checked git log the next time in a command prompt, it only gave me this:
    >git log
    commit b7aa332a80c16be8c74c51fb7c2f7cdb8e4e8ff2 (grafted, HEAD -> documentation/graph-traversal-build-fix, origin/documentation/graph-traversal-build-fix)
    Author: Simran ...
    Date:   Fri Mar 8 15:18:44 2019 +0100
    
        Merge remote-tracking branch 'origin/devel' into documentation/graph-traversal-build-fix
    
    
    So the entire history of that branch looks like a single commit and is the merge commit (the one I was behind before the Checkout via the GitHub extension)
  • Shortly after, I noted that it said grafted. In a shallow clone of a repository, it would be expected that you see a truncated history. However, my repo wasn’t a shallow clone but a normal working copy with the entire history.
  • The PR on GitHub based on the documentation/graph-traversal-build-fix branch looked alright, so I deleted my local branch and checked out the remote branch - but the history remained a single commit
  • Then I tried to reset --hard, but this didn’t change anything either

I cloned the entire repo to a new folder, and there the branch is fine, i.e. the entire history is listed as expected. Does this mean some cache in the original working copy got corrupted?

What does the GitHub extension do exactly if you check out pull requests? Is there any chance for breaking the working copy as described? Is it caused by how the extension uses Git, or does this sound like a bug in Git itself?

If you want to analyze the (possibly) corrupted working copy, download it here: arangodb-grafted.7z (1.1 GB)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

11reactions
sunsationscommented, Apr 9, 2019

@Simran-B I had the same problem. Solution was to delete the .git/shallow file.

6reactions
deepskyblue86commented, Dec 6, 2021

Same here. git fetch --unshallow did the job.

Read more comments on GitHub >

github_iconTop Results From Across the Web

git shallow clone - how do I remove the "grafted tag" and what ...
Using git filter-branch tells Git to copy the commits. The copies obey the shallow cutoff, so that they are truly the only commit...
Read more >
git-filter-branch Documentation - Git
NOTE: This command honors .git/info/grafts file and refs in the ... This is not a real filter executed for each commit but a...
Read more >
Manage Git branches | IntelliJ IDEA Documentation - JetBrains
In the Branches popup or in the Branches pane of the Git tool window, select a branch that you want to check out...
Read more >
10 things I hate about Git - Steve Bennett blogs
But the shortcut for “git branch” combined with “git checkout”? ... To reset one file in your working directory to its committed state:...
Read more >
10. Editing History - Git Pocket Guide [Book] - O'Reilly
The general purpose of git rebase is to move a branch from one location to ... but merely abandoned: they are no longer...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found