...
The above command will open your editor where you willl the commit message. If the commit message only is a single line then you can pass it directly to commit command: git commit -m 'Your commit message'
.
How can I see information about a commit?
Code Block | ||
---|---|---|
| ||
$ git show <COMMIT> |
I forgot to add some changes to my commit, can I update my last commit?
Yes, but you will be mutating history. If you have already pushed the commit, then other people might depend on the commit you are about to mutate. If you have only pushed the commit to your personal fork and you are not currently collaborating with someone, then it is fine to mutate the history (you yourself are the only one who will be affected). If you have pushed the commit to a project repository, then it is not fine to mutate history, since you cause problem for other contributors.
In many cases, for example when working on a pull request, you can just make an additional commit and push it. The Skara integrate command will squash (collapse) the commits in the pull request into a single commit before integrating it, so the final result will be as if you only had made one commit.
If you still want to mutate history and update the last commit, first add the files you want to add to the commit:
Code Block | ||
---|---|---|
| ||
$ git add path/to/file1 path/to/file2 |
Then run the following command to amend the HEAD
commit:
Code Block | ||
---|---|---|
| ||
$ git commit --amend --no-edit |
GitHub
Configuration
How do I setup two-factor authentication (2FA)?
...