Thursday, March 05, 2015

Preserving History When Renaming Files in git by Scott Nelson of This by Them

Preserving History When Renaming Files in git by Scott Nelson of This by Them

REMEMBER, GIT TRACKS CONTENT, NOT FILES

Git doesn’t really care that we renamed the file, but it knows that we moved the contents of the file to another file. When we tell git to show us the history for a particular file name, it will only show us the history for that file, not the entire history for the content within the file.
In order to see the entire history for that content, we need to tell git that’s specifically what we want. There’s a --follow option we can pass to git logfor this.

So, to see our commits before the rename, we can do git log --follow just-an-everage-blog-post.md and voila, there’s our entire history for the content of that file.

No comments:

Popular micro services patterns

Here are some popular Microservice design patterns that a programmer should know: Service Registry  pattern provides a  central location  fo...