paint-brush
Why You Can Sometimes Use git push -f: Rewriting Code Repository Historyby@shepelev
6,928 reads
6,928 reads

Why You Can Sometimes Use git push -f: Rewriting Code Repository History

by Alexey Shepelev8mDecember 24th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

The git push -f command removes all commits, which are not in the local version, from the server branch and writes new ones. The same commit can appear in several branches at the same time. When we try to merge a branch with rewritten history and branches where the history has been preserved, we will get a great number of conflicts (according to the number of commits) There is an unpleasant side of rewriting history: those commits that seem to be removed from the branch do not actually disappear anywhere and simply remain forever hanging in the repo.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail

Coin Mentioned

Mention Thumbnail
featured image - Why You Can Sometimes Use git push -f: Rewriting Code Repository History
Alexey Shepelev HackerNoon profile picture
Alexey Shepelev

Alexey Shepelev

@shepelev

Senior Ruby on Rails Developer

About @shepelev
LEARN MORE ABOUT @SHEPELEV'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Alexey Shepelev HackerNoon profile picture
Alexey Shepelev@shepelev
Senior Ruby on Rails Developer

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite