diff --git a/assets/images/help/desktop/mac-changed-file-header.png b/assets/images/help/desktop/mac-changed-file-header.png new file mode 100644 index 000000000000..064f82597392 Binary files /dev/null and b/assets/images/help/desktop/mac-changed-file-header.png differ diff --git a/assets/images/help/desktop/mac-discard-stashed-changes-button.png b/assets/images/help/desktop/mac-discard-stashed-changes-button.png new file mode 100644 index 000000000000..be1631765ef5 Binary files /dev/null and b/assets/images/help/desktop/mac-discard-stashed-changes-button.png differ diff --git a/assets/images/help/desktop/mac-restore-stashed-changes-button.png b/assets/images/help/desktop/mac-restore-stashed-changes-button.png new file mode 100644 index 000000000000..1a0ae797d6d0 Binary files /dev/null and b/assets/images/help/desktop/mac-restore-stashed-changes-button.png differ diff --git a/assets/images/help/desktop/mac-stash-all-changes.png b/assets/images/help/desktop/mac-stash-all-changes.png new file mode 100644 index 000000000000..454f631f419b Binary files /dev/null and b/assets/images/help/desktop/mac-stash-all-changes.png differ diff --git a/assets/images/help/desktop/windows-changed-file-header.png b/assets/images/help/desktop/windows-changed-file-header.png new file mode 100644 index 000000000000..e1051eacd869 Binary files /dev/null and b/assets/images/help/desktop/windows-changed-file-header.png differ diff --git a/assets/images/help/desktop/windows-discard-stashed-changes-button.png b/assets/images/help/desktop/windows-discard-stashed-changes-button.png new file mode 100644 index 000000000000..5437acfea7bf Binary files /dev/null and b/assets/images/help/desktop/windows-discard-stashed-changes-button.png differ diff --git a/assets/images/help/desktop/windows-restore-stashed-changes-button.png b/assets/images/help/desktop/windows-restore-stashed-changes-button.png new file mode 100644 index 000000000000..289d2f420f3a Binary files /dev/null and b/assets/images/help/desktop/windows-restore-stashed-changes-button.png differ diff --git a/assets/images/help/desktop/windows-stash-all-changes.png b/assets/images/help/desktop/windows-stash-all-changes.png new file mode 100644 index 000000000000..2bf3afad8d50 Binary files /dev/null and b/assets/images/help/desktop/windows-stash-all-changes.png differ diff --git a/content/desktop/contributing-and-collaborating-using-github-desktop/index.md b/content/desktop/contributing-and-collaborating-using-github-desktop/index.md index 3b94ba23119e..2e0f6b62fd21 100644 --- a/content/desktop/contributing-and-collaborating-using-github-desktop/index.md +++ b/content/desktop/contributing-and-collaborating-using-github-desktop/index.md @@ -19,6 +19,7 @@ versions: {% topic_link_in_list /making-changes-in-a-branch %} {% link_in_list /managing-branches %} {% link_in_list /committing-and-reviewing-changes-to-your-project %} + {% link_in_list /stashing-changes %} {% link_in_list /pushing-changes-to-github %} {% link_in_list /reverting-a-commit %} {% link_in_list /managing-tags %} diff --git a/content/desktop/contributing-and-collaborating-using-github-desktop/managing-branches.md b/content/desktop/contributing-and-collaborating-using-github-desktop/managing-branches.md index 879ecd209788..4d7155e72240 100644 --- a/content/desktop/contributing-and-collaborating-using-github-desktop/managing-branches.md +++ b/content/desktop/contributing-and-collaborating-using-github-desktop/managing-branches.md @@ -67,8 +67,7 @@ If you create a branch on {% data variables.product.product_name %}, you'll need ![The Publish branch button](/assets/images/help/desktop/publish-branch-button.png) ### Switching between branches -You can view and make commits to any of your repository's branches. If you have uncommitted, saved changes, you'll need to decide what to do with your changes before you can switch branches. You can commit your changes on the current branch, stash your changes on the current branch, or bring the changes to your new branch. If you want to commit your changes on the current branch, follow the steps in "[Committing and reviewing changes to your project](/desktop/contributing-to-projects/committing-and-reviewing-changes-to-your-project)" before switching branches. - +You can view and make commits to any of your repository's branches. If you have uncommitted, saved changes, you'll need to decide what to do with your changes before you can switch branches. You can commit your changes on the current branch, stash your changes to temporarily save them on the current branch, or bring the changes to your new branch. If you want to commit your changes before switching branches, see "[Committing and reviewing changes to your project](/desktop/contributing-to-projects/committing-and-reviewing-changes-to-your-project)." {% tip %} **Tip**: You can set a default behavior for switching branches in the **Advanced** settings. For more information, see "[Configuring basic settings](/desktop/getting-started-with-github-desktop/configuring-basic-settings)." @@ -81,17 +80,6 @@ You can view and make commits to any of your repository's branches. If you have 3. If you have saved, uncommitted changes, choose **Leave my changes** or **Bring my changes**, then click **Switch Branch**. ![Switch branch with changes options](/assets/images/help/desktop/stash-changes-options.png) -### Retrieving stashed changes -To access changes you've stashed in another branch, switch back to the branch you stashed the changes in. - -{% data reusables.desktop.current-branch-menu %} -{% data reusables.desktop.switching-between-branches %} - ![List of branches in the repository](/assets/images/help/desktop/click-branch-in-drop-down-mac.png) -3. In the left sidebar, click **Stashed Changes**. -![Stashed changes option](/assets/images/help/desktop/stashed-changes.png) -4. To delete your stashed changes, click **Discard**, or to use your stashed changes, click **Restore**. -![Discard or Restore stashed changes](/assets/images/help/desktop/discard-restore-stash-buttons.png) - ### Deleting a branch You can't delete a branch if it's currently associated with an open pull request. You cannot undo deleting a branch. @@ -120,3 +108,4 @@ You can't delete a branch if it's currently associated with an open pull request - "[Branch](/articles/github-glossary/#branch)" in the {% data variables.product.prodname_dotcom %} glossary - "[About branches](/articles/about-branches)" - "[Branches in a Nutshell](https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell)" in the Git documentation +- "[Stashing changes](/desktop/contributing-and-collaborating-using-github-desktop/stashing-changes)" diff --git a/content/desktop/contributing-and-collaborating-using-github-desktop/stashing-changes.md b/content/desktop/contributing-and-collaborating-using-github-desktop/stashing-changes.md new file mode 100644 index 000000000000..54122ffc3917 --- /dev/null +++ b/content/desktop/contributing-and-collaborating-using-github-desktop/stashing-changes.md @@ -0,0 +1,29 @@ +--- +title: Stashing changes +intro: You can temporarily save your changes without committing them to a branch by stashing the changes. +versions: + free-pro-team: '*' +--- + +### About stashed changes + +To apply your changes to your repository, you must save the files and then commit the changes to a branch. If you have saved changes that you are not ready to commit yet, you can stash the changes for later. When you stash changes, the changes are temporarily removed from the files and you can choose to restore or discard the changes later. You can only stash one set of changes at a time with {% data variables.product.prodname_desktop %}. If you use {% data variables.product.prodname_desktop %} to stash changes, all unsaved changes will be stashed. After you stash changes on a branch, you can safely change branches or make other changes to your current branch. + +If you use {% data variables.product.prodname_desktop %} to switch branches while you have saved, but not committed, changes, {% data variables.product.prodname_desktop %} will prompt you to stash the changes or bring them to the other branch. For more information, see "[Managing branches](/desktop/contributing-to-projects/managing-branches#switching-between-branches)." + +### Stashing changes + +{% data reusables.desktop.click-changed-files-header %} +{% data reusables.desktop.click-stash-all-changes %} + +### Restoring stashed changes + +{% data reusables.desktop.navigate-to-stashed-changes %} +{% data reusables.desktop.click-stashed-changes %} +{% data reusables.desktop.click-restore %} + +### Discarding stashed changes + +{% data reusables.desktop.navigate-to-stashed-changes %} +{% data reusables.desktop.click-stashed-changes %} +{% data reusables.desktop.click-discard %} diff --git a/data/reusables/desktop/click-changed-files-header.md b/data/reusables/desktop/click-changed-files-header.md new file mode 100644 index 000000000000..ddd2e675db97 --- /dev/null +++ b/data/reusables/desktop/click-changed-files-header.md @@ -0,0 +1,13 @@ +1. Right click the **changed files** header. + + {% mac %} + + ![The changed files header](/assets/images/help/desktop/mac-changed-file-header.png) + + {% endmac %} + + {% windows %} + + ![The changed files header](/assets/images/help/desktop/windows-changed-file-header.png) + + {% endwindows %} \ No newline at end of file diff --git a/data/reusables/desktop/click-discard.md b/data/reusables/desktop/click-discard.md new file mode 100644 index 000000000000..95b253fef3ea --- /dev/null +++ b/data/reusables/desktop/click-discard.md @@ -0,0 +1,13 @@ +1. Click **Discard**. + + {% mac %} + + ![Discard stashed changes button](/assets/images/help/desktop/mac-discard-stashed-changes-button.png) + + {% endmac %} + + {% windows %} + + ![Discard stashed changes button](/assets/images/help/desktop/windows-discard-stashed-changes-button.png) + + {% endwindows %} diff --git a/data/reusables/desktop/click-restore.md b/data/reusables/desktop/click-restore.md new file mode 100644 index 000000000000..ce7cbdfc9cdb --- /dev/null +++ b/data/reusables/desktop/click-restore.md @@ -0,0 +1,13 @@ +1. Click **Restore**. + + {% mac %} + + ![Restore stashed changes button](/assets/images/help/desktop/mac-restore-stashed-changes-button.png) + + {% endmac %} + + {% windows %} + + ![Restore stashed changes button](/assets/images/help/desktop/windows-restore-stashed-changes-button.png) + + {% endwindows %} diff --git a/data/reusables/desktop/click-stash-all-changes.md b/data/reusables/desktop/click-stash-all-changes.md new file mode 100644 index 000000000000..deab24f2012e --- /dev/null +++ b/data/reusables/desktop/click-stash-all-changes.md @@ -0,0 +1,13 @@ +1. Click **Stash All Changes**. + + {% mac %} + + ![The Stash All Changes menu item](/assets/images/help/desktop/mac-stash-all-changes.png) + + {% endmac %} + + {% windows %} + + ![The Stash all changes menu item](/assets/images/help/desktop/windows-stash-all-changes.png) + + {% endwindows %} \ No newline at end of file diff --git a/data/reusables/desktop/click-stashed-changes.md b/data/reusables/desktop/click-stashed-changes.md new file mode 100644 index 000000000000..b2c82378c4ba --- /dev/null +++ b/data/reusables/desktop/click-stashed-changes.md @@ -0,0 +1,2 @@ +1. In the left sidebar, click **Stashed Changes**. + ![Stashed changes option](/assets/images/help/desktop/stashed-changes.png) \ No newline at end of file diff --git a/data/reusables/desktop/navigate-to-stashed-changes.md b/data/reusables/desktop/navigate-to-stashed-changes.md new file mode 100644 index 000000000000..9980422ed5f2 --- /dev/null +++ b/data/reusables/desktop/navigate-to-stashed-changes.md @@ -0,0 +1,2 @@ +1. If you are not already on the branch where the changes are stashed, click {% octicon "git-branch" aria-label="The branch icon" %} **Current Branch**, then click the branch with stashed changes. + ![List of branches in the repository](/assets/images/help/desktop/click-branch-in-drop-down-mac.png) \ No newline at end of file