Skip to content

[Enhancement] Warn when leaving commits behind on checkout #1463

Closed
@Doodeletion

Description

@Doodeletion

Commits create while head is detached are lost on the next checkout.
Git warns you if you do this.

$ git checkout main
Warning: you are leaving 1 commit behind, not connected to
any of your branches:

  f0511ae while detached

If you want to keep it by creating a new branch, this may be a good time
to do so with:

 git branch <new-branch-name> f0511ae

Switched to branch 'main'
Your branch is ahead of 'origin/main' by 1 commit.
  (use "git push" to publish your local commits)

SourceGit just checks out the branch you selected and the commit is lost (although restorable). Ideally, SourceGit would prompt if the commit should be left behind before the checkout happens. Simply displaying the warning provided by Git would be fine too.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions