Search code examples
gitgithubcommand-line-interfacegit-stash

Git command line equivalent of GitHub app's magic stashing?


According to the GitHup app documentation, "when you switch branches, GitHub [for Mac] performs magic stashing" (e.g., see the end of this page).

Does anyone know the git command line equivalent of this "magic stashing"?


Solution

  • Suppose you are working on the branch current-branch. Basically, what happens in Git-terms:

    git stash
    git checkout other-branch
    

    Then, when you checkout current-branch again. The following happens

    git stash pop
    

    The git stash stores the uncommitted changes in the working directory. When you return the branch, a git stash pop is used to grab the uncommitted changes from the stash and place them on top of the current-branch