-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
WIP Split Commit Message into Subject / Description Fields #711
WIP Split Commit Message into Subject / Description Fields #711
Conversation
This PR is a UX enhancement for the Git Workspace. Currently commit messages can only be added in a single-line text input, which is difficult to read and to edit a descriptive message. With this update, commit messages are broken up into two inputs: a subject line and a description box. Both inputs are combined into a single commit message string when submitting a commit or a pull request. Only the subject line is required to create a new commit or open a pr. If a description is provided, it will be appended to the subject line, with a blank line in between. Subject lines are recommended to be no more than 72 characters in length. To help with this, there is a character count indicator which will display red if a subject line goes over this length. There is no hard enforcement here, as it's merely a recommendation. Please read the following for more information on why 72 was chosen: https://stackoverflow.com/questions/2290016/git-commit-messages-50-72-formatting https://medium.com/@preslavrachev/what-s-with-the-50-72-rule-8a906f61f09c This is currently a work in progress. The above features as outlined have been implemented and appear to work. Before moving forward I'd like to open this up for discussion and feedback so I can clean up the implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really great! Thank you very much for this!
I left some cleanup comments, if I see everything correctly it's possible to remove the message
logic from the code now. Or is it used somewhere else still?
@@ -56,6 +65,8 @@ export const createPr = [ | |||
set(state`git.isCreatingPr`, false), | |||
wait(3000), | |||
actions.openPr, | |||
set(state`git.subject`, ''), | |||
set(state`git.description`, ''), | |||
set(state`git.message`, ''), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove this now, right?
@@ -43,6 +50,8 @@ export const createCommit = [ | |||
true: [wait(1000), set(state`currentModal`, null)], | |||
false: [], | |||
}, | |||
set(state`git.subject`, ''), | |||
set(state`git.description`, ''), | |||
set(state`git.message`, ''), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this one too.
@@ -14,6 +14,8 @@ export default { | |||
isExported: types.boolean, | |||
showExportedModal: types.boolean, | |||
isFetching: types.boolean, | |||
subject: types.string, | |||
description: types.string, | |||
message: types.string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this I believe.
state`git.description`, | ||
props`description` | ||
); | ||
|
||
export const changeMessage = set(state`git.message`, props`message`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this one too I think.
@@ -23,6 +25,8 @@ export default Module({ | |||
createRepoClicked: sequences.createRepo, | |||
gitMounted: fetchGitChanges, | |||
createCommitClicked: sequences.createCommit, | |||
subjectChanged: sequences.changeSubject, | |||
descriptionChanged: sequences.changeDescription, | |||
messageChanged: sequences.changeMessage, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this one.
This PR is a UX enhancement for the Git Workspace. Currently commit messages can only be added in a single-line text input, which is difficult to read and to edit a descriptive message. With this update, commit messages are broken up into two inputs: a subject line and a description box. Both inputs are combined into a single commit message string when submitting a commit or a pull request. Only the subject line is required to create a new commit or open a pr. If a description is provided, it will be appended to the subject line, with a blank line in between. Subject lines are recommended to be no more than 72 characters in length. To help with this, there is a character count indicator which will display red if a subject line goes over this length. There is no hard enforcement here, as it's merely a recommendation. Please read the following for more information on why 72 was chosen: https://stackoverflow.com/questions/2290016/git-commit-messages-50-72-formatting https://medium.com/@preslavrachev/what-s-with-the-50-72-rule-8a906f61f09c This is currently a work in progress. The above features as outlined have been implemented and appear to work. Before moving forward I'd like to open this up for discussion and feedback so I can clean up the implementation.
…iption' into git-commit-message-subject-description
@CompuIves I don't believe they're being used anywhere else. Just left it in there for you to advise on whether or not to remove before going ahead and doing so. I implemented the changes as requested, so unless there's anything else you'd like me to do, we should be good to go! |
Oh nice! I'll merge this in now then 😄. I was a bit confused by the WIP so that's why it took me some time to respond. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
<WorkspaceSubtitle | ||
style={{ | ||
color: | ||
store.git.subject.length > 72 ? `#F27777` : `#556362`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I loooove this subtle detail!
This PR is a UX enhancement for the Git Workspace. Currently commit messages can only be added in a single-line text input, which is difficult to read and to edit a descriptive message.
With this update, commit messages are broken up into two inputs: a subject line and a description box. Both inputs are combined into a single commit message string when submitting a commit or a pull request.
Only the subject line is required to create a new commit or open a pr. If a description is provided, it will be appended to the subject line, with a blank line in between. Subject lines are recommended to be no more than 72 characters in length. To help with this, there is a character count indicator which will display red if a subject line goes over this length. There is no hard enforcement here, as it's merely a recommendation. Please read the following for more information on why 72 was chosen:
https://stackoverflow.com/questions/2290016/git-commit-messages-50-72-formatting
https://medium.com/@preslavrachev/what-s-with-the-50-72-rule-8a906f61f09c
This is currently a work in progress. The above features as outlined have been implemented and appear to work. Before moving forward I'd like to open this up for discussion and feedback so I can clean up the implementation.