jesseduffield / lazygit

simple terminal UI for git commands
MIT License
48.12k stars 1.73k forks source link

A branch matches the remote version, but Lazygit incorrectly regards it as diverged. #3710

Open dwy6626 opened 5 days ago

dwy6626 commented 5 days ago

Describe the bug My branch matches the remote one, but when I use the push command, Lazygit always prompts to force push.

To Reproduce

  1. Create a new branch
  2. push it to remote
  3. push it again

Expected behavior It should run git push for me and without force push prompt.

Version info: Run lazygit --version and paste the result here

commit=6fcb7eb8bb616c170506312870b3bf15f3dbe37c, build date=2024-05-19T10:15:28Z, build source=binaryRelease, version=0.42.0, os=darwin, arch=arm64, git version=2.39.3 (Apple Git-146)

Run git --version and paste the result here

git version 2.39.3 (Apple Git-146)

Additional context debug log attached

Jul  2 13:46:31 |INFO| language: C
Jul  2 13:46:31 |DEBU| RunCommand command="git --version"
Jul  2 13:46:31 |INFO| git --version (21.4275ms)
Jul  2 13:46:31 |DEBU| RunCommand command="git rev-parse --git-dir"
Jul  2 13:46:31 |INFO| git rev-parse --git-dir (21.676875ms)
Jul  2 13:46:31 |DEBU| RunCommand command="git rev-parse --is-bare-repository"
Jul  2 13:46:31 |INFO| git rev-parse --is-bare-repository (16.917459ms)
Jul  2 13:46:31 |DEBU| RunCommand command="git rev-parse --path-format=absolute --show-toplevel --absolute-git-dir --git-common-dir --show-superproject-working-tree"
Jul  2 13:46:31 |INFO| git rev-parse --path-format=absolute --show-toplevel --absolute-git-dir --git-common-dir --show-superproject-working-tree (26.685416ms)
Jul  2 13:46:31 |INFO| starting main loop
Jul  2 13:46:31 |INFO| Binary is not built with the buildBinary flag so we won't check for an update
Jul  2 13:46:31 |DEBU| RunCommand command="git rev-parse --is-bare-repository"
Jul  2 13:46:31 |DEBU| RunCommand command="git fetch --all --no-write-fetch-head"
Jul  2 13:46:31 |INFO| git rev-parse --is-bare-repository (18.59225ms)
Jul  2 13:46:31 |INFO| refreshing all scopes in async mode
Jul  2 13:46:31 |DEBU| RunCommand command="git rev-parse --abbrev-ref --verify HEAD"
Jul  2 13:46:31 |INFO| Refresh took 306µs
Jul  2 13:46:31 |DEBU| RunCommand command="git stash list -z --pretty=%ct|%gs"
Jul  2 13:46:31 |DEBU| RunCommand command="git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(push:track)%00%(subject)%00%(objectname)%00%(committerdate:unix) refs/heads"
Jul  2 13:46:31 |DEBU| RunCommand command="git tag --list -n --sort=-creatordate"
Jul  2 13:46:31 |INFO| git rev-parse --abbrev-ref --verify HEAD (32.771167ms)
Jul  2 13:46:31 |DEBU| RunCommand command="git merge-base main main@{u}"
Jul  2 13:46:31 |DEBU| RunCommand command="git rev-parse --symbolic-full-name main@{u}"
Jul  2 13:46:31 |DEBU| RunCommand command="git rev-parse --symbolic-full-name master@{u}"
Jul  2 13:46:31 |DEBU| Error getting git config value for key: status.showUntrackedFiles. Error: the key is not found for [git config --get --null status.showUntrackedFiles]
Jul  2 13:46:31 |DEBU| RunCommand command="git status --untracked-files=all --porcelain -z"
Jul  2 13:46:31 |INFO| git for-each-ref --sort=refname --format=%(refname:short) refs/remotes (44.426ms)
Jul  2 13:46:31 |INFO| git tag --list -n --sort=-creatordate (44.885458ms)
Jul  2 13:46:31 |INFO| postRefreshUpdate for tags took 68.291µs
Jul  2 13:46:31 |INFO| postRefreshUpdate for remotes took 3.2235ms
Jul  2 13:46:31 |INFO| postRefreshUpdate for remoteBranches took 25.958µs
Jul  2 13:46:31 |INFO| git stash list -z --pretty=%ct|%gs (52.516334ms)
Jul  2 13:46:31 |INFO| postRefreshUpdate for stash took 216.834µs
Jul  2 13:46:31 |INFO| git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(push:track)%00%(subject)%00%(objectname)%00%(committerdate:unix) refs/heads (55.0925ms)
Jul  2 13:46:31 |DEBU| RunCommand command="git worktree list --porcelain"
Jul  2 13:46:31 |INFO| git -c log.showSignature=false log -g --abbrev=40 --format=%h%x00%ct%x00%gs%x00%p (64.318292ms)
Jul  2 13:46:31 |INFO| postRefreshUpdate for reflogCommits took 2.233916ms
Jul  2 13:46:31 |INFO| git merge-base main main@{u} (36.584083ms)
Jul  2 13:46:31 |INFO| git rev-parse --symbolic-full-name main@{u} (36.187458ms)
Jul  2 13:46:31 |DEBU| Error getting git config value for key: rebase.updateRefs. Error: the key is not found for [git config --get --null rebase.updateRefs]
Jul  2 13:46:31 |INFO| git worktree list --porcelain (28.824583ms)
Jul  2 13:46:31 |DEBU| RunCommand command="git -C /Users/deweiye/houzz/epn rev-parse --path-format=absolute --absolute-git-dir"
Jul  2 13:46:31 |ERRO| fatal: no such branch: 'master'
 command="git rev-parse --symbolic-full-name master@{u}"
Jul  2 13:46:31 |INFO| git rev-parse --symbolic-full-name master@{u} (51.168417ms)
Jul  2 13:46:31 |DEBU| RunCommand command="git rev-parse --verify --quiet refs/remotes/origin/master"
Jul  2 13:46:31 |INFO| git log HEAD --topo-order --oneline --pretty=format:%H%x00%at%x00%aN%x00%ae%x00%D%x00%p%x00%m%x00%s --abbrev=40 -300 --no-show-signature -- (51.879042ms)
Jul  2 13:46:31 |INFO| git -C /Users/deweiye/houzz/epn rev-parse --path-format=absolute --absolute-git-dir (26.54125ms)
Jul  2 13:46:31 |INFO| postRefreshUpdate for worktrees took 89.334µs
Jul  2 13:46:31 |INFO| postRefreshUpdate for localBranches took 3.291292ms
Jul  2 13:46:31 |ERRO| <no msg> command="git rev-parse --verify --quiet refs/remotes/origin/master"
Jul  2 13:46:31 |INFO| git rev-parse --verify --quiet refs/remotes/origin/master (29.99775ms)
Jul  2 13:46:31 |DEBU| RunCommand command="git rev-parse --verify --quiet refs/heads/master"
Jul  2 13:46:31 |ERRO| <no msg>
Jul  2 13:46:31 |INFO| git rev-parse --verify --quiet refs/heads/master (20.763958ms)
Jul  2 13:46:31 |DEBU| RunCommand command="git merge-base HEAD refs/remotes/origin/main"
Jul  2 13:46:31 |INFO| git status --untracked-files=all --porcelain -z (102.631333ms)
Jul  2 13:46:31 |INFO| postRefreshUpdate for submodules took 9.958µs
Jul  2 13:46:31 |INFO| postRefreshUpdate for files took 30.5µs
Jul  2 13:46:31 |INFO| git merge-base HEAD refs/remotes/origin/main (16.465083ms)
Jul  2 13:46:31 |DEBU| using cache for key rebase.updateRefs
Jul  2 13:46:31 |INFO| postRefreshUpdate for commits took 3.861ms
Jul  2 13:46:31 |DEBU| using cache for key rebase.updateRefs
Jul  2 13:46:31 |DEBU| RunCommand command="git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(push:track)%00%(subject)%00%(objectname)%00%(committerdate:unix) refs/heads"
Jul  2 13:46:31 |INFO| git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(push:track)%00%(subject)%00%(objectname)%00%(committerdate:unix) refs/heads (18.707583ms)
Jul  2 13:46:31 |INFO| postRefreshUpdate for localBranches took 2.768875ms
Jul  2 13:46:31 |DEBU| using cache for key rebase.updateRefs
Jul  2 13:46:31 |DEBU| RunCommand command="git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium refs/heads/main --"
Jul  2 13:46:34 |DEBU| RunCommand
Jul  2 13:46:34 |DEBU| RunCommand command="git checkout test-123"
Jul  2 13:46:34 |ERRO| error: pathspec 'test-123' did not match any file(s) known to git

Jul  2 13:46:34 |INFO| git checkout test-123 (39.955792ms)
Jul  2 13:46:35 |INFO| git fetch --all --no-write-fetch-head (3.722231541s)
Jul  2 13:46:35 |INFO| refreshing the following scopes in async mode: branches,commits,remotes,tags
Jul  2 13:46:35 |DEBU| RunCommand command="git tag --list -n --sort=-creatordate"
Jul  2 13:46:35 |INFO| Refresh took 304.583µs
Jul  2 13:46:35 |DEBU| RunCommand command="git rev-parse --abbrev-ref --verify HEAD"
Jul  2 13:46:35 |INFO| git -c log.showSignature=false log -g --abbrev=40 --format=%h%x00%ct%x00%gs%x00%p (37.198292ms)
Jul  2 13:46:35 |INFO| git tag --list -n --sort=-creatordate (38.425417ms)
Jul  2 13:46:35 |INFO| postRefreshUpdate for tags took 25.917µs
Jul  2 13:46:35 |INFO| postRefreshUpdate for reflogCommits took 1.820292ms
Jul  2 13:46:35 |DEBU| RunCommand command="git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(push:track)%00%(subject)%00%(objectname)%00%(committerdate:unix) refs/heads"
Jul  2 13:46:35 |INFO| git for-each-ref --sort=refname --format=%(refname:short) refs/remotes (40.960875ms)
Jul  2 13:46:35 |INFO| postRefreshUpdate for remotes took 137.041µs
Jul  2 13:46:35 |INFO| postRefreshUpdate for remoteBranches took 12.417µs
Jul  2 13:46:35 |INFO| git rev-parse --abbrev-ref --verify HEAD (43.733916ms)
Jul  2 13:46:35 |DEBU| RunCommand command="git merge-base main main@{u}"
Jul  2 13:46:35 |DEBU| RunCommand command="git merge-base HEAD refs/remotes/origin/main"
Jul  2 13:46:35 |INFO| git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(push:track)%00%(subject)%00%(objectname)%00%(committerdate:unix) refs/heads (36.455917ms)
Jul  2 13:46:35 |INFO| git merge-base main main@{u} (31.3295ms)
Jul  2 13:46:35 |INFO| git merge-base HEAD refs/remotes/origin/main (31.996209ms)
Jul  2 13:46:35 |INFO| postRefreshUpdate for localBranches took 3.700875ms
Jul  2 13:46:35 |INFO| git log HEAD --topo-order --oneline --pretty=format:%H%x00%at%x00%aN%x00%ae%x00%D%x00%p%x00%m%x00%s --abbrev=40 -300 --no-show-signature -- (37.63675ms)
Jul  2 13:46:35 |DEBU| using cache for key rebase.updateRefs
Jul  2 13:46:35 |DEBU| RunCommand command="git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium refs/heads/main --"
Jul  2 13:46:35 |DEBU| RunCommand command="git checkout -b test-123 refs/heads/main"
Jul  2 13:46:35 |INFO| postRefreshUpdate for commits took 6.373334ms
Jul  2 13:46:35 |DEBU| using cache for key rebase.updateRefs
Jul  2 13:46:35 |INFO| git checkout -b test-123 refs/heads/main (29.243666ms)
Jul  2 13:46:35 |INFO| refreshing all scopes in async mode
Jul  2 13:46:35 |DEBU| RunCommand command="git tag --list -n --sort=-creatordate"
Jul  2 13:46:35 |DEBU| RunCommand command="git stash list -z --pretty=%ct|%gs"
Jul  2 13:46:35 |DEBU| RunCommand command="git rev-parse --abbrev-ref --verify HEAD"
Jul  2 13:46:35 |DEBU| using cache for key status.showUntrackedFiles
Jul  2 13:46:35 |DEBU| RunCommand command="git status --untracked-files=all --porcelain -z"
Jul  2 13:46:35 |INFO| Refresh took 1.269334ms
Jul  2 13:46:35 |INFO| git for-each-ref --sort=refname --format=%(refname:short) refs/remotes (38.500959ms)
Jul  2 13:46:35 |INFO| git tag --list -n --sort=-creatordate (39.745334ms)
Jul  2 13:46:35 |INFO| postRefreshUpdate for remotes took 91.25µs
Jul  2 13:46:35 |INFO| postRefreshUpdate for remoteBranches took 5.125µs
Jul  2 13:46:35 |INFO| postRefreshUpdate for tags took 6µs
Jul  2 13:46:35 |INFO| git rev-parse --abbrev-ref --verify HEAD (48.624625ms)
Jul  2 13:46:35 |INFO| git -c log.showSignature=false log -g --abbrev=40 --format=%h%x00%ct%x00%gs%x00%p (49.393208ms)
Jul  2 13:46:35 |DEBU| RunCommand command="git merge-base test-123 test-123@{u}"
Jul  2 13:46:35 |DEBU| RunCommand command="git merge-base HEAD refs/remotes/origin/main"
Jul  2 13:46:35 |INFO| git stash list -z --pretty=%ct|%gs (55.972334ms)
Jul  2 13:46:35 |INFO| postRefreshUpdate for stash took 50.833µs
Jul  2 13:46:35 |INFO| postRefreshUpdate for reflogCommits took 8.416416ms
Jul  2 13:46:35 |DEBU| RunCommand command="git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(push:track)%00%(subject)%00%(objectname)%00%(committerdate:unix) refs/heads"
Jul  2 13:46:35 |ERRO| fatal: no upstream configured for branch 'test-123'
 command="git merge-base test-123 test-123@{u}"
Jul  2 13:46:35 |INFO| git merge-base test-123 test-123@{u} (33.71125ms)
Jul  2 13:46:35 |INFO| git merge-base HEAD refs/remotes/origin/main (35.654833ms)
Jul  2 13:46:35 |INFO| git log HEAD --topo-order --oneline --pretty=format:%H%x00%at%x00%aN%x00%ae%x00%D%x00%p%x00%m%x00%s --abbrev=40 -300 --no-show-signature -- (41.921375ms)
Jul  2 13:46:35 |DEBU| using cache for key rebase.updateRefs
Jul  2 13:46:35 |INFO| git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(push:track)%00%(subject)%00%(objectname)%00%(committerdate:unix) refs/heads (33.769375ms)
Jul  2 13:46:35 |DEBU| RunCommand command="git worktree list --porcelain"
Jul  2 13:46:35 |INFO| postRefreshUpdate for commits took 3.4755ms
Jul  2 13:46:35 |INFO| git status --untracked-files=all --porcelain -z (103.093167ms)
Jul  2 13:46:35 |INFO| postRefreshUpdate for submodules took 19.208µs
Jul  2 13:46:35 |INFO| postRefreshUpdate for files took 4.792µs
Jul  2 13:46:35 |INFO| git worktree list --porcelain (16.931375ms)
Jul  2 13:46:35 |DEBU| RunCommand command="git -C /Users/deweiye/houzz/epn rev-parse --path-format=absolute --absolute-git-dir"
Jul  2 13:46:35 |INFO| git -C /Users/deweiye/houzz/epn rev-parse --path-format=absolute --absolute-git-dir (14.602708ms)
Jul  2 13:46:35 |INFO| postRefreshUpdate for worktrees took 37.375µs
Jul  2 13:46:35 |DEBU| RunCommand command="git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium refs/heads/test-123 --"
Jul  2 13:46:35 |INFO| postRefreshUpdate for localBranches took 3.342083ms
Jul  2 13:46:35 |DEBU| using cache for key rebase.updateRefs
Jul  2 13:46:36 |DEBU| Error getting git config value for key: push.default. Error: the key is not found for [git config --get --null push.default]
Jul  2 13:46:36 |DEBU| RunCommand command="git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium refs/heads/test-123 --"
Jul  2 13:46:36 |DEBU| RunCommand command="git push --set-upstream origin test-123"
Jul  2 13:46:39 |INFO| git push --set-upstream origin test-123 (2.805602416s)
Jul  2 13:46:39 |INFO| refreshing all scopes in async mode
Jul  2 13:46:39 |INFO| Refresh took 113.542µs
Jul  2 13:46:39 |DEBU| RunCommand command="git stash list -z --pretty=%ct|%gs"
Jul  2 13:46:39 |DEBU| RunCommand command="git tag --list -n --sort=-creatordate"
Jul  2 13:46:39 |DEBU| using cache for key status.showUntrackedFiles
Jul  2 13:46:39 |DEBU| RunCommand command="git rev-parse --abbrev-ref --verify HEAD"
Jul  2 13:46:39 |DEBU| RunCommand command="git status --untracked-files=all --porcelain -z"
Jul  2 13:46:39 |INFO| git tag --list -n --sort=-creatordate (28.871084ms)
Jul  2 13:46:39 |INFO| postRefreshUpdate for tags took 22.125µs
Jul  2 13:46:39 |INFO| git -c log.showSignature=false log -g --abbrev=40 --format=%h%x00%ct%x00%gs%x00%p (33.447958ms)
Jul  2 13:46:39 |INFO| git rev-parse --abbrev-ref --verify HEAD (35.460666ms)
Jul  2 13:46:39 |DEBU| RunCommand command="git merge-base test-123 test-123@{u}"
Jul  2 13:46:39 |DEBU| RunCommand command="git merge-base HEAD refs/remotes/origin/main"
Jul  2 13:46:39 |INFO| git for-each-ref --sort=refname --format=%(refname:short) refs/remotes (46.042958ms)
Jul  2 13:46:39 |INFO| git stash list -z --pretty=%ct|%gs (50.543375ms)
Jul  2 13:46:39 |INFO| postRefreshUpdate for stash took 139.125µs
Jul  2 13:46:39 |INFO| postRefreshUpdate for reflogCommits took 17.062167ms
Jul  2 13:46:39 |INFO| postRefreshUpdate for remotes took 137.875µs
Jul  2 13:46:39 |INFO| postRefreshUpdate for remoteBranches took 3.166µs
Jul  2 13:46:39 |DEBU| RunCommand command="git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(push:track)%00%(subject)%00%(objectname)%00%(committerdate:unix) refs/heads"
Jul  2 13:46:39 |INFO| git merge-base HEAD refs/remotes/origin/main (36.983ms)
Jul  2 13:46:39 |ERRO| fatal: upstream branch 'refs/heads/test-123' not stored as a remote-tracking branch
 command="git merge-base test-123 test-123@{u}"
Jul  2 13:46:39 |INFO| git merge-base test-123 test-123@{u} (45.856625ms)
Jul  2 13:46:39 |INFO| git log HEAD --topo-order --oneline --pretty=format:%H%x00%at%x00%aN%x00%ae%x00%D%x00%p%x00%m%x00%s --abbrev=40 -300 --no-show-signature -- (44.252ms)
Jul  2 13:46:39 |DEBU| using cache for key rebase.updateRefs
Jul  2 13:46:39 |INFO| git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(push:track)%00%(subject)%00%(objectname)%00%(committerdate:unix) refs/heads (33.569875ms)
Jul  2 13:46:39 |DEBU| RunCommand command="git worktree list --porcelain"
Jul  2 13:46:39 |INFO| postRefreshUpdate for commits took 3.982167ms
Jul  2 13:46:39 |INFO| git status --untracked-files=all --porcelain -z (97.209417ms)
Jul  2 13:46:39 |INFO| postRefreshUpdate for submodules took 10.125µs
Jul  2 13:46:39 |INFO| postRefreshUpdate for files took 3.709µs
Jul  2 13:46:39 |INFO| git worktree list --porcelain (17.270083ms)
Jul  2 13:46:39 |DEBU| RunCommand command="git -C /Users/deweiye/houzz/epn rev-parse --path-format=absolute --absolute-git-dir"
Jul  2 13:46:39 |INFO| git -C /Users/deweiye/houzz/epn rev-parse --path-format=absolute --absolute-git-dir (14.989208ms)
Jul  2 13:46:39 |INFO| postRefreshUpdate for worktrees took 73.125µs
Jul  2 13:46:39 |DEBU| RunCommand command="git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium refs/heads/test-123 --"
Jul  2 13:46:39 |INFO| postRefreshUpdate for localBranches took 3.34525ms
Jul  2 13:46:39 |DEBU| using cache for key rebase.updateRefs
Jul  2 13:46:41 |INFO| refreshing the following scopes in sync mode: files
Jul  2 13:46:41 |INFO| refreshed merge conflicts in 239.5µs
Jul  2 13:46:41 |DEBU| using cache for key status.showUntrackedFiles
Jul  2 13:46:41 |DEBU| RunCommand command="git status --untracked-files=all --porcelain -z"
Jul  2 13:46:41 |INFO| git status --untracked-files=all --porcelain -z (89.863917ms)
Jul  2 13:46:41 |INFO| refreshed files in 90.780458ms
Jul  2 13:46:41 |INFO| Refresh took 91.284584ms
Jul  2 13:46:41 |INFO| postRefreshUpdate for submodules took 28.666µs
Jul  2 13:46:41 |INFO| postRefreshUpdate for files took 16.459µs
Jul  2 13:46:42 |DEBU| RunCommand command="git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium refs/heads/test-123 --"
Jul  2 13:46:42 |DEBU| RunCommand command="git push --force-with-lease"
Jul  2 13:46:46 |INFO| git push --force-with-lease (3.347356959s)
Jul  2 13:46:46 |INFO| refreshing all scopes in async mode
Jul  2 13:46:46 |INFO| Refresh took 107.5µs
Jul  2 13:46:46 |DEBU| RunCommand command="git stash list -z --pretty=%ct|%gs"
Jul  2 13:46:46 |DEBU| RunCommand command="git tag --list -n --sort=-creatordate"
Jul  2 13:46:46 |DEBU| RunCommand command="git rev-parse --abbrev-ref --verify HEAD"
Jul  2 13:46:46 |DEBU| using cache for key status.showUntrackedFiles
Jul  2 13:46:46 |DEBU| RunCommand command="git status --untracked-files=all --porcelain -z"
Jul  2 13:46:46 |INFO| git -c log.showSignature=false log -g --abbrev=40 --format=%h%x00%ct%x00%gs%x00%p (35.63975ms)
Jul  2 13:46:46 |INFO| postRefreshUpdate for reflogCommits took 2.371ms
Jul  2 13:46:46 |DEBU| RunCommand command="git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(push:track)%00%(subject)%00%(objectname)%00%(committerdate:unix) refs/heads"
Jul  2 13:46:46 |INFO| git rev-parse --abbrev-ref --verify HEAD (38.976209ms)
Jul  2 13:46:46 |DEBU| RunCommand command="git merge-base test-123 test-123@{u}"
Jul  2 13:46:46 |DEBU| RunCommand command="git merge-base HEAD refs/remotes/origin/main"
Jul  2 13:46:46 |INFO| git for-each-ref --sort=refname --format=%(refname:short) refs/remotes (47.524875ms)
Jul  2 13:46:46 |INFO| postRefreshUpdate for remotes took 402.583µs
Jul  2 13:46:46 |INFO| postRefreshUpdate for remoteBranches took 11.875µs
Jul  2 13:46:46 |INFO| git stash list -z --pretty=%ct|%gs (51.871791ms)
Jul  2 13:46:46 |INFO| postRefreshUpdate for stash took 127.333µs
Jul  2 13:46:46 |INFO| git tag --list -n --sort=-creatordate (62.013458ms)
Jul  2 13:46:46 |INFO| postRefreshUpdate for tags took 22.834µs
Jul  2 13:46:46 |INFO| git merge-base HEAD refs/remotes/origin/main (37.468958ms)
Jul  2 13:46:46 |ERRO| fatal: upstream branch 'refs/heads/test-123' not stored as a remote-tracking branch
 command="git merge-base test-123 test-123@{u}"
Jul  2 13:46:46 |INFO| git merge-base test-123 test-123@{u} (38.247458ms)
Jul  2 13:46:46 |INFO| git log HEAD --topo-order --oneline --pretty=format:%H%x00%at%x00%aN%x00%ae%x00%D%x00%p%x00%m%x00%s --abbrev=40 -300 --no-show-signature -- (42.307917ms)
Jul  2 13:46:46 |DEBU| using cache for key rebase.updateRefs
Jul  2 13:46:46 |INFO| git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(push:track)%00%(subject)%00%(objectname)%00%(committerdate:unix) refs/heads (44.776417ms)
Jul  2 13:46:46 |DEBU| RunCommand command="git worktree list --porcelain"
Jul  2 13:46:46 |INFO| postRefreshUpdate for commits took 4.384125ms
Jul  2 13:46:46 |INFO| git status --untracked-files=all --porcelain -z (95.241667ms)
Jul  2 13:46:46 |INFO| postRefreshUpdate for submodules took 8.166µs
Jul  2 13:46:46 |INFO| postRefreshUpdate for files took 3.875µs
Jul  2 13:46:46 |INFO| git worktree list --porcelain (16.937625ms)
Jul  2 13:46:46 |DEBU| RunCommand command="git -C /Users/deweiye/houzz/epn rev-parse --path-format=absolute --absolute-git-dir"
Jul  2 13:46:46 |INFO| git -C /Users/deweiye/houzz/epn rev-parse --path-format=absolute --absolute-git-dir (14.496625ms)
Jul  2 13:46:46 |INFO| postRefreshUpdate for worktrees took 34.125µs
Jul  2 13:46:46 |DEBU| RunCommand command="git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium refs/heads/test-123 --"
Jul  2 13:46:46 |INFO| postRefreshUpdate for localBranches took 3.940541ms
Jul  2 13:46:46 |DEBU| using cache for key rebase.updateRefs
sesponda commented 5 days ago

I'm experiencing the same. I've added my logs and versions here: https://gist.github.com/sesponda/11983c0cfbde01ac8374c719a3214404

stefanhaller commented 5 days ago

Can't explain this yet, we need some more information. First of all, what does lazygit show in the branches panel for the test-123 branch? (My guess is a question mark.)

Second, in the log it says that lazygit did git push --set-upstream origin test-123 on the first push, but then right afterwards, git merge-base test-123 test-123@{u} errored with "fatal: upstream branch 'refs/heads/test-123' not stored as a remote-tracking branch". This is the bit that I don't understand. If you execute those two commands in the terminal (with a new local branch), what's the output?

dwy6626 commented 5 days ago

Hi @stefanhaller, for the 1st question your guess is correct, it shows a question mark. As for running the command in terminal I got these outputs:

> git push --set-upstream origin test-456
branch 'test-456' set up to track 'origin/test-456'.
Everything up-to-date
> git merge-base test-456 test-456@{u}
fatal: upstream branch 'refs/heads/test-456' not stored as a remote-tracking branch
stefanhaller commented 5 days ago

I'm still confused. 😅 Can I ask for more command output?

git for-each-ref --format="%(refname),%(upstream),%(upstream:track),%(push:track)" refs/heads | grep test-

and

git remote -v show origin

(This second command can produce a lot of output depending on how many branches you have; feel free to cut all the information about branches except for your test- branches.)

dwy6626 commented 4 days ago

sure, here are the outputs

$ git for-each-ref --format="%(refname),%(upstream),%(upstream:track),%(push:track)" refs/heads | grep test-

refs/heads/test-456,,,
$ git remote -v show origin

* remote origin
  Fetch URL: git@github.com:Houzz/epn.git
  Push  URL: git@github.com:Houzz/epn.git
  HEAD branch: main
  Remote branch:
    main tracked
  Local branches configured for 'git pull':
    main                          merges with remote main
...
    test-456                      merges with remote test-456
  Local refs configured for 'git push':
    main                        pushes to main                        (up to date)
...
    test-456                    pushes to test-456                    (up to date)
stefanhaller commented 1 day ago

I have absolutely no idea how this can be explained. I asked on the git mailing list, and got a reply from Jeff King (one of the git maintainers, and a real pro), who asked a few more questions. Do you want to subscribe to the list and talk to him directly, or would you prefer me to do that on your behalf? I'm happy to do that if you want, in that case I'd ask you to provide the information he's asking about here.