Git Cheat Sheet · Changes
Commit
git commit -m <message>
A commit records the content of the index as a new step in the current branch's history. git commit -m "message" creates the commit with its message. First stage the files you want with git add.
What it does
Records the content of the index as a new commit on the current branch.
A use case
Your fix is staged and tested: you record it with a message explaining why.
On the command line
git commit -m "Fix the VAT calculation"- Commit with a one-line message.
git commit- Opens the editor to write a summary, a blank line, then a description.
git commit -am "message"- First stages all files already tracked, then commits. New files are not included.
git commit --amend- Fixes the last commit.
git config --global user.name / user.email- Sets the name and email written in your commits.
In Merathon
- Stage the files you want.
- Enter the summary (and a description if needed) at the bottom of the right panel.
- Click "Commit", or Ctrl+Enter from the input field.
Frequently asked questions
How do I write a good commit message?
A short summary (about 50 characters), in the imperative, that says what the commit changes. If needed, a description after a blank line that explains why.
How do I undo a commit that has not been pushed yet?
git reset --soft HEAD~1 undoes the commit and keeps its changes staged.