Skip to content
Discussion options

You must be logged in to vote

When you use git push --force, you're indeed overwriting the history of the branch on the remote repository with your local history. However, GitHub doesn't immediately remove the old commits from the "Active" tab in the repository interface. This is because Git, by design, keeps a reference to old commits for a certain period of time, even after they've been removed from the active branch.

The reason behind this behavior is to provide a safety net for developers. If you accidentally force push and delete important commits, they can still be recovered within a certain time frame, usually 30 days by default, through Git's reflog or other recovery mechanisms. During this time, the old commi…

Replies: 2 comments 4 replies

This comment was marked as off-topic.

@gudzilla
Comment options

@arashtabaa

This comment was marked as off-topic.

@gudzilla
Comment options

Comment options

You must be logged in to vote
1 reply
@am-i-abdullah
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Repositories The core of version-controlled code storage Question Ask and answer questions about GitHub features and usage
4 participants