Skip to content

Commit bc544e7

Browse files
authored
Merge pull request #1324 from github/split-diffs-and-discarding-lines
Split diffs and discarding lines
2 parents f7ef8b8 + c5fc4ff commit bc544e7

5 files changed

Lines changed: 26 additions & 23 deletions

File tree

73 KB
Loading
95.6 KB
Loading
35.1 KB
Loading

content/desktop/contributing-and-collaborating-using-github-desktop/committing-and-reviewing-changes-to-your-project.md

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,48 +35,51 @@ As you make changes to files in your text editor and save them locally, you will
3535

3636
#### Creating a partial commit
3737

38-
If one file contains multiple changes, but you only want *some* of those changes to be included in a commit, you can create a partial commit. The rest of your changes will remain intact, so that you can make additional modifications and commits. This allows you to make separate, meaningful commits, such as keeping line break changes in a commit separate from code or prose changes.
38+
If one file contains multiple changes, but you only want some of those changes to be included in a commit, you can create a partial commit. The rest of your changes will remain intact, so that you can make additional modifications and commits. This allows you to make separate, meaningful commits, such as keeping line break changes in a commit separate from code or prose changes.
3939

40-
When you review the diff of the file, the lines that will be included in the commit are highlighted in blue. To exclude the change, click the changed line so the blue disappears.
40+
{% note %}
41+
42+
**Note:** Split diff displays are currently in beta and subject to change.
43+
44+
{% endnote %}
4145

42-
![Unselected lines in a file](/assets/images/help/desktop/partial-commit.png)
46+
1. To choose how your changes are displayed, in the top-right corner of the changed file, use {% octicon "gear" aria-label="The Gear icon" %} to select **Unified** or **Split**.
47+
![Gear icon with unified and split diffs](/assets/images/help/desktop/gear-diff-select.png)
48+
2. To exclude changed lines from your commit, click one or more changed lines so the blue disappears. The lines that are still highlighted in blue will be included in the commit.
49+
![Unselected lines in a file](/assets/images/help/desktop/partial-commit.png)
4350

44-
#### Discarding changes
51+
### 3. Discarding changes
52+
If you have uncommitted changes that you don't want to keep, you can discard the changes. This will remove the changes from the files on your computer. You can discard all uncommitted changes in one or more files, or you can discard specific lines you added.
4553

46-
You can discard all the uncommitted changes in one file, a range of files, or discard all changes in all files since the last commit.
54+
Discarded changes are saved in a dated file in the Trash. You can recover discarded changes until the Trash is emptied.
4755

48-
{% mac %}
56+
#### Discarding changes in one or more files
4957

5058
{% data reusables.desktop.select-discard-files %}
5159
{% data reusables.desktop.click-discard-files %}
5260
![Discard Changes option in context menu](/assets/images/help/desktop/discard-changes-mac.png)
5361
{% data reusables.desktop.confirm-discard-files %}
5462
![Discard Changes button in the confirmation dialog](/assets/images/help/desktop/discard-changes-confirm-mac.png)
5563

56-
{% tip %}
64+
#### Discarding changes in one or more lines
65+
You can discard one or more changed lines that are uncommitted.
5766

58-
**Tip:** The changes you discarded are saved in a dated file in the Trash and you can recover them until the Trash is emptied.
59-
60-
{% endtip %}
67+
{% note %}
6168

62-
{% endmac %}
69+
**Note:** Discarding single lines is disabled in a group of changes that adds and removes lines.
6370

64-
{% windows %}
71+
{% endnote %}
6572

66-
{% data reusables.desktop.select-discard-files %}{% data reusables.desktop.click-discard-files %}
67-
![Discard Changes option in context menu](/assets/images/help/desktop/discard-changes-win.png)
68-
{% data reusables.desktop.confirm-discard-files %}
69-
![Discard Changes button in the confirmation dialog](/assets/images/help/desktop/discard-changes-confirm-win.png)
73+
To discard one added line, in the list of changed lines, right click on the line you want to discard and select **Discard added line**.
7074

71-
{% tip %}
75+
![Discard single line in the confirmation dialog](/assets/images/help/desktop/discard-single-line.png)
7276

73-
**Tip:** The changes you discarded are saved in a file in the Recycle Bin and you can recover them until it is emptied.
77+
To discard a group of changed lines, right click the vertical bar to the right of the line numbers for the lines you want to discard, then select **Discard added lines**.
7478

75-
{% endtip %}
79+
![Discard a group of added lines in the confirmation dialog](/assets/images/help/desktop/discard-multiple-lines.png)
7680

77-
{% endwindows %}
7881

79-
### 3. Write a commit message and push your changes
82+
### 4. Write a commit message and push your changes
8083

8184
Once you're satisfied with the changes you've chosen to include in your commit, write your commit message and push your changes. If you've collaborated on a commit, you can also attribute a commit to more than one author.
8285

content/github/committing-changes-to-your-project/creating-a-commit-with-multiple-authors.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ For more information, see "[Setting your commit email address](/articles/setting
3131

3232
### Creating co-authored commits using {% data variables.product.prodname_desktop %}
3333

34-
You can use {% data variables.product.prodname_desktop %} to create a commit with a co-author. For more information, see "[Write a commit message and push your changes](/desktop/contributing-to-projects/committing-and-reviewing-changes-to-your-project#3-write-a-commit-message-and-push-your-changes)" and [{% data variables.product.prodname_desktop %}](https://desktop.github.com).
34+
You can use {% data variables.product.prodname_desktop %} to create a commit with a co-author. For more information, see "[Write a commit message and push your changes](/desktop/contributing-to-projects/committing-and-reviewing-changes-to-your-project#4-write-a-commit-message-and-push-your-changes)" and [{% data variables.product.prodname_desktop %}](https://desktop.github.com).
3535

3636
![Add a co-author to the commit message](/assets/images/help/desktop/co-authors-demo-hq.gif)
3737

@@ -75,4 +75,4 @@ The new commit and message will appear on {% data variables.product.product_loca
7575
- "[Viewing a summary of repository activity](/articles/viewing-a-summary-of-repository-activity)"
7676
- "[Viewing a project's contributors](/articles/viewing-a-projects-contributors)"
7777
- "[Changing a commit message](/articles/changing-a-commit-message)"
78-
- "[Committing and reviewing changes to your project](/desktop/contributing-to-projects/committing-and-reviewing-changes-to-your-project#3-write-a-commit-message-and-push-your-changes)" in the {% data variables.product.prodname_desktop %} documentation
78+
- "[Committing and reviewing changes to your project](/desktop/contributing-to-projects/committing-and-reviewing-changes-to-your-project#4-write-a-commit-message-and-push-your-changes)" in the {% data variables.product.prodname_desktop %} documentation

0 commit comments

Comments
 (0)