Search code examples
gitgit-tower

Cant stash new img files in git tower


Im using Tower 2 to manage my bitbucket git repos. Ive added some img files to the repo and editted some html and js files, these are not ready to be committed so i saved them as a stash. This worked fine for the html and js files which were editted filed (as opposed to new files) the img files where new files but its not letting me stash these.

Is there a way to stash new files or do they need be committed first ?


Solution

  • TL'DR: Yes.

    Actually there are two ways:

    Stashing untracked files using Tower 2

    From Tower 2 Manual:

    Saving Changes on a Stash

    Since stashing is such an important feature, Tower makes using it very easy: in the toolbar, you can click [Save Stash] or press [⌘ + ⇧ + S] at any time to save your current local changes.

    Providing a short but descriptive message will help you distinguish different Stashes later. As an option, Tower also offers to include untracked files when saving a Stash. (emphasized by myself)

    All you need to do is check the little checkbox following the textfield for the stash-message in the Save-Stash-Dialog.

    Software hickups

    If you did so, but your stash isn't saved correctly, you should probably check in with the Tower Support team. To make their job easier you might want to test stashing via command line first.

    Stashing untracked files using the command line client

    Regardless of any software you use, you can always stash manually via the command line tool.

    The command you are looking for is git stash save -u

    Understanding git-stash

    As torek's answer explains what is going on with git stash under the hood, I highly suggest you read it and the linked question. In a nutshell Tower does use the command line tools internally and gives you a sophisticated GUI interface for it. As always, you can dive into details and options via the manual on git-stash.