Skip to content

Corrected lines to be no longer than 78 characters.#522

Merged
sigmavirus24 merged 1 commit into
realpython:masterfrom
vpzee:master
Mar 1, 2015
Merged

Corrected lines to be no longer than 78 characters.#522
sigmavirus24 merged 1 commit into
realpython:masterfrom
vpzee:master

Conversation

@vpzee

@vpzee vpzee commented Mar 1, 2015

Copy link
Copy Markdown

No description provided.

@sigmavirus24

Copy link
Copy Markdown
Contributor

Since you mentioned on your last PR that you want to learn about OSS and the like, I'll assume that you're also opening to learning about git.

Commit messages are really really really valuable in source control. On this project they're slightly less important, but on other projects they're very important as reading them can help track the origin of a bug. Having two (or more), adjacent commits with exactly the same message is unhelpful for tracking bugs down. When you're working on your changes and notice that you want to do this, the best option is instead to do:

git add changed-file1.ext changed-file2.ext # etc.
git commit --amend

The latter bit will update your last commit with the changes you've just made without creating a second commit with the same message. If you've already pushed to a branch on a remote repository, you'll have to update it with

git push --force origin my-branch:my-branch
# or more simply
git push --force origin HEAD

That said, you've already made two commits with the same message, but fear not, there's a way to update them (actually there are two ways, but I'll show you the simpler way here).

  1. git reset HEAD^. This will do a "soft" reset of your history. It means the changes in the last commit are not lost but the commit doesn't exist in the history anymore. (You can verify this with git status and git log). HEAD always refers to most recent commit, HEAD^ refers to the second most recent, HEAD^^ refers to the third most recent, etc.
  2. git status should tell you that all the files are modified and in your index (git diff should be empty while git diff --cached should have the changes from 4da01ac). If this isn't the case, you'll need to add the files changed in 4da01ac with git add.
  3. git commit --amend As described above, this will update the (now) most recent commit, which in this case will be fd1a37c.
  4. Now that you've updated fd1a37c, you should look at git log and note that the sha has changed. This is expected.
  5. Now git push --force and this pull request will update with your changes.
  6. Ping me when you're done or if you've run into a snag.

@vpzee

vpzee commented Mar 1, 2015

Copy link
Copy Markdown
Author

Thank you so much for your explanation.

I think I got it corrected now.

@sigmavirus24

Copy link
Copy Markdown
Contributor

Perfect! 🍰

sigmavirus24 added a commit that referenced this pull request Mar 1, 2015
Corrected lines to be no longer than 78 characters.
@sigmavirus24 sigmavirus24 merged commit 874b47d into realpython:master Mar 1, 2015
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.

2 participants