Commit to save work with GitKraken when changing files. Whether you commit to other things in life is up to you...
Making a commit
To make a commit in GitKraken, select your Work in Progress and to view recent changes on the Commit Panel.
Select the files you wish to stage, and click on any files you wish to review in the diff. To stage all your files, use the keyboard shortcut ⌘ShiftS for Mac or CtrlShiftS for Windows or Linux.
When you’re ready, type your message and hit commit to commit your changes. You can also use this Commit keyboard shortcut ⌘ + Enter for Mac or Ctrl + Enter if you are on Linux or Windows.
The graph updates with your commit, but the undo button or this keyboard shortcut ⌘ + Z for Mac or Ctrl + Z for Windows/Linux can undo a commit made by mistake.
GitKraken allows you to amend a commit message, add additional changes, or both.
To add more changes, amend a commit by clicking on the //WIP node on the graph.
Stage the target files and then be sure to check the Amend box to apply your changes to the previous commit.
If you only need to update the commit message, select the most recent commit and click in the message box to amend the message.
Note: Amending commits which are already pushed to a remote are more difficult to apply and would require a force push for the rewrite.
Git keeps track of your current commit in a file called the HEAD. When resetting a commit, you update the HEAD of your repo to point to the selected commit. GitKraken offers the following reset options:
- Soft - resets the HEAD to the selected commit, but keeps your changes staged and in your WIP directory
- Mixed - resets the HEAD to the selected commit, unstages your changes, but keeps them in your WIP directory
- Hard - resets the HEAD to the selected commit, unstages your changes, and deletes your WIP files
You may also drag and drop a branch onto another to select from the three reset options above or access the reset options from your local repos in the left panel.
Undo, undo, undo. You can undo many of your actions in GitKraken with the Undo icon.
If you're a keyboard fan, you may also enjoy using the keyboard shortcut ⌘ + z for Mac or Ctrl + Z for not-Mac.
If you wish to revert a commit (perhaps Undo is not available), the option is available when right-clicking on a commit node. This will create a new commit to reverse your previous changes.