Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Hi,

I’d like a way in Lazygit to make my current local branch exactly match its remote counterpart.

In other words, I want to discard all local changes and any local-only commits, then reset the current branch to the latest version from origin.

The Git equivalent would be something like:

git fetch origin && git reset --hard origin/$(git branch --show-current)

Ideally, this could be exposed as a clear action in Lazygit, for example:

“Reset local branch to remote”

A confirmation prompt would be important, as this is a destructive action and would discard local changes and commits that have not been pushed.

My use case is simple: sometimes I no longer need the local state and just want to overwrite it completely with the remote version of the same branch, without having to leave Lazygit or manually type the Git commands.

It would be great if this action clearly showed which local branch and remote branch are involved before confirming the reset.

Thanks,
Marco

You must be logged in to vote

Replies: 2 comments · 2 replies

Comment options

This is available for the currently checked out branch; to access it, you need to focus the Files panel (that's a bit unintuitive, admittedly) and press g there. This gives you a menu with options to reset to this branch's @{upstream}.

You must be logged in to vote
2 replies
@marc0janssen
Comment options

Oh... thanks.... I was look for it in de shift-D options, in de file-panel.... completely overlooked "g"....

Wouldn't it be better to merge them... g and shift-D are related...

@stefanhaller
Comment options

All the shift-D options reset to the current HEAD; g is different because it resets to a different commit. For that reason I'd like to keep them separate.

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
💡
Ideas
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.