gitkraken / vscode-gitlens

Supercharge Git inside VS Code and unlock untapped knowledge within each repository — Visualize code authorship at a glance via Git blame annotations and CodeLens, seamlessly navigate and explore Git repositories, gain valuable insights via rich visualizations and powerful comparison commands, and so much more

Home Page:http://gitkraken.com/gitlens

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove --first-parent from git commands to show file history from merged in repositories

Daemeron opened this issue · comments

Output:

getBlameForLine('/Users/xxx/Source/yyy', '/Users/xxx/Source/yyy/shop/src/components/pages/checkout/confirmation/Expanded.tsx', 'undefined', 148)
getBlameForFile[Cached(blame)]('/Users/xxx/Source/yyy', '/Users/xxx/Source/yyy/shop/src/components/pages/checkout/confirmation/Expanded.tsx', 'undefined')
isTracked('shop/src/components/pages/checkout/confirmation/Expanded.tsx', '/Users/xxx/Source/yyy')
Running(/Users/xxx/Source/yyy): git ls-files shop/src/components/pages/checkout/confirmation/Expanded.tsx
GitExplorer[view=repository].refreshNode(gitlens:repository:active)
Completed(/Users/xxx/Source/yyy): git ls-files shop/src/components/pages/checkout/confirmation/Expanded.tsx Completed in 34 ms
isTracked('shop/src/components/pages/checkout/confirmation/Expanded.tsx', '/Users/xxx/Source/yyy') = true
HistoryExplorer.refresh reason='active-editor-changed'
getStatusForFile('/Users/xxx/Source/yyy', '/Users/xxx/Source/yyy/shop/src/components/pages/checkout/confirmation/Expanded.tsx')
Running(/Users/xxx/Source/yyy): git -c color.status=false status --porcelain=v2 shop/src/components/pages/checkout/confirmation/Expanded.tsx
Completed(/Users/xxx/Source/yyy): git -c color.status=false status --porcelain=v2 shop/src/components/pages/checkout/confirmation/Expanded.tsx Completed in 27 ms
getLogForFile[Not Cached(log:follow)]('/Users/xxx/Source/yyy', '/Users/xxx/Source/yyy/shop/src/components/pages/checkout/confirmation/Expanded.tsx', undefined, undefined, undefined, false)
isTracked('shop/src/components/pages/checkout/confirmation/Expanded.tsx', '/Users/xxx/Source/yyy')
Running(/Users/xxx/Source/yyy): git ls-files shop/src/components/pages/checkout/confirmation/Expanded.tsx
Add log cache for '/users/xxx/source/yyy/shop/src/components/pages/checkout/confirmation/expanded.tsx:log:follow'
Completed(/Users/xxx/Source/yyy): git ls-files shop/src/components/pages/checkout/confirmation/Expanded.tsx Completed in 18 ms
isTracked('shop/src/components/pages/checkout/confirmation/Expanded.tsx', '/Users/xxx/Source/yyy') = true
Running(/Users/xxx/Source/yyy): git log --name-status -M --format=%x3c%x2ff%x3e%n%x3cr%x3e %H%n%x3ca%x3e %an%n%x3ce%x3e %ae%n%x3cd%x3e %at%n%x3cp%x3e %P%n%x3cs%x3e%n%B%n%x3c%x2fs%x3e%n%x3cf%x3e -n200 --follow -m --first-parent -- shop/src/components/pages/checkout/confirmation/Expanded.tsx
Completed(/Users/xxx/Source/yyy): git log --name-status -M --format=%x3c%x2ff%x3e%n%x3cr%x3e %H%n%x3ca%x3e %an%n%x3ce%x3e %ae%n%x3cd%x3e %at%n%x3cp%x3e %P%n%x3cs%x3e%n%B%n%x3c%x2fs%x3e%n%x3cf%x3e -n200 --follow -m --first-parent -- shop/src/components/pages/checkout/confirmation/Expanded.tsx Completed in 283 ms
isTracked('shop/src/components/pages/checkout/confirmation/Expanded.tsx', '/Users/xxx/Source/yyy')
isTracked('shop/src/components/pages/checkout/confirmation/Expanded.tsx', '/Users/xxx/Source/yyy') = true
Keyboard.beginScope 0
getLogForFile[Cached(log:follow)]('/Users/xxx/Source/yyy', '/Users/xxx/Source/yyy/shop/src/components/pages/checkout/confirmation/Expanded.tsx', 'undefined', undefined, undefined, true, false)
getBranch('/Users/xxx/Source/yyy')
Running(/Users/xxx/Source/yyy): git rev-parse --abbrev-ref --symbolic-full-name @ @{u}
Completed(/Users/xxx/Source/yyy): git rev-parse --abbrev-ref --symbolic-full-name @ @{u} Completed in 23 ms
getRemotes('/Users/xxx/Source/yyy')
Keyboard.beginScope 1
KeyboardScope.dispose 2 0
KeyboardScope.dispose 1 0
ResultsExplorer.refreshNode()
  • GitLens Version: 8.4.1
  • VSCode Version: 1.24.1 (24f62626b222e9a8313213fb64b10d741a326288)
  • OS Version: MacOS 10.13.5 (17F77)

Steps to Reproduce:

  1. Follow 2 repository merge scenario
# Note: If using ssh you need to enable extended globbbing in the following way and use ^ to negate the pattern

git clone git@server.com:old-project.git
git clone git@server.com:new-project.git

# If you want the old project to be a subdirectory of the new project, add this: !(old-project) is a bashism that says “everything but old-project”. If your project is called the girl, then you move “everything but the girl”.
cd old-project
mkdir old-project
git mv !(old-project) old-project
# Note: If using ssh you need to enable extended globbbing in the following way and use ^ to negate the pattern
setopt extendedglob
git mv ^old-project old-project
# or 
git mv ^(old-project|something-else) old-project
# commit the move
git commit -a -S -m “Moving old project into its own subdirectory”

# Now comes the merging part. What we’re doing is add a remote to the old project, and merge everything into the new one. Since git doesn’t allow merges without a common history, we’ll have to force it using the allow-unrelated-histories option. And since we love well-maintained projects, we’re doing everything in a branch we’ll merge after a code review is done.
cd ../new-project
git remote add old-project ../old-project
git fetch old-project
git checkout -b feature/merge-old-project
git merge -S --allow-unrelated-histories old-project/master
git push origin feature/merge-old-project
git remote rm old-project
  1. Try to see file history for new old project files. Only merge commit will be shown in the ui. This is because in order to see sub-tree merged repository history fully, git commands need --follow flag. Logs show that it is added but soon after another flag is added --first-parent which returns command to default behavior.

@eamodio Thank you! 👍

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.