Skip to content

Treat version history as a resource #734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nickcharlton
Copy link
Member

When composed with care, the version history in a code repository becomes a valuable resource for the future.

For example, it allows you to use git blame to see how files changed and understand from the commit messages why such changes were made, allowing you to understand the constraints under what those changes can be made and explain why the code was written that way.

To do this, you should ensure you write enough detail for someone else (or perhaps yourself in future) to understand the change in depth. You should link to external resources, but understand that those can change and so a link alone is not enough. You should rebase to avoid messy ordering, and compose your changes with care so that they can be understood at a glance.

When composed with care, the version history in a code repository
becomes a valuable resource for the future.

For example, it allows you to use `git blame` to see how files changed
and understand from the commit messages _why_ such changes were made,
allowing you to understand the constraints under what those changes can
be made and explain why the code was written that way.

To do this, you should ensure you write enough detail for someone else
(or perhaps yourself in future) to understand the change in depth. You
should link to external resources, but understand that those can change
and so a link alone is not enough. You should rebase to avoid messy
ordering, and compose your changes with care so that they can be
understood at a glance.
Copy link
Contributor

@JoelQ JoelQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! Big fan of this!

@@ -4,6 +4,7 @@ A guide for programming within version control.

## Best Practices

- Treat the version history as a resource for the future.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate a bit more here? I love what you have in the PR description although that's probably too long. Maybe some kind of happy medium?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't work out how to shorten it to fit in a line or two. Any ideas?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something along the lines of "Explain the why and not the what"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An idea for incorporating some of the content from the PR description

Suggested change
- Treat the version history as a resource for the future.
- Treat the version history as a resource for the future. Structure your commits such that they tell the story of _why_ the change was made, so that future developers--including yourself!--can understand the constraints which influenced your decisions at the time.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #738 we introduced the pattern of adding a markdown file with the reasoning and examples. You might consider doing the same.

Those would be nice blog posts too.

Copy link
Contributor

@jutonz jutonz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love it! tyvm :)

@@ -4,6 +4,7 @@ A guide for programming within version control.

## Best Practices

- Treat the version history as a resource for the future.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An idea for incorporating some of the content from the PR description

Suggested change
- Treat the version history as a resource for the future.
- Treat the version history as a resource for the future. Structure your commits such that they tell the story of _why_ the change was made, so that future developers--including yourself!--can understand the constraints which influenced your decisions at the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants