When you are working on a project, the staging pane is where changes are prepped for commit.
Staging files
Staging adds selected file contents to the index, which is like flagging your work as good to go.
To start, select the //WIP node to see all your files on the Commit Panel.
Once the //WIP node is selected, a will appear when you hover over a file in the Commit Panel.
You may also click on a file for review in the diff or click the . To stage specific lines, select the file, highlight the target lines, then right-click to access the Stage selected lines option.
For quickly staging changes, checkout the available Staging keyboard shortcuts on hand!
From here you should be set to commit!
Unstaging
Unstage files by selecting a staged file and hitting the button that appears. If you click on a file to view the diff, you can selectively unstage lines or hunks.
If you need to unstage all files, use the button just above the Staged Files section. From here you should be set to commit!
Discarding files
As you review your files, you may meticulously stage lines or hunks of changes or discard changes.
To discard changes, select the //WIP node to summon the icon. This option will discard all changes or discard any multi-selected files.
If more than one changes needs to be discard, multi-select files to multi-discard.
Next, you may discard hunks of changes from the diff of any file.
Alternatively in the staging panel, Discard Changes
is available in the context menu by right-click.
Ignoring Files
You can use the .gitignore
file to tell GitKraken Desktop to ignore files in your repo that you don’t want to be tracked.
You can view the .gitignore
documentation for rules and formatting on the git-scm website.
To ignore a file, right click on the file in the commit panel and select Ignore.
From this menu you may choose to ignore:
- The specific file selected
- All files with that same file extension
- All files in that same directory
GitKraken Desktop will create the .gitignore
file (unless one already exists) at the root of your repo directory and add the appropriate entry, based on your ignore selection.
Note: GitKraken Desktop will only look at the .gitignore
located at the root of your repo directory. Nested .gitignore files are not parsed.
Ignoring previously tracked files
If a file was previously committed to your repo, then you will see the following options when you attempt to ignore it:
Selecting Ignore
will add the corresponding entry to the .gitignore file, but the changes will not be ignored, because the file is already being tracked by git.
Selecting Ignore and Stop Tracking
will add the corresponding entry to the .gitignore
file and remove the file from the git index, so git stops tracking it.