git stash and git pull

When you have changes on your working copy, from command line do: git stash This will stash your changes and clear your status report git pull This will pull changes from upstream branch. Make sure it says fast-forward in the report. If it doesn’t, you are probably doing an unintended merge git stash pop This … Read more

In git, is there a way to show untracked stashed files without applying the stash?

Untracked files are stored in the third parent of a stash commit. (This isn’t actually documented, but is pretty obvious from The commit which introduced the -u feature, 787513…, and the way the rest of the documentation for git-stash phrases things… or just by doing git log –graph ‘stash@{0}’) You can view just the “untracked” … Read more

What is the difference between IntelliJ’s Shelve and Git stash?

From the IntelliJ documentation: In the Git integration, in addition to shelving and unshelving, “stashing” and “unstashing” are supported respectively. These features have much in common, the only difference is in the way patches are generated and applied. Patches with stashed changes are generated by Git itself. To apply them later, you do not need … Read more

How can I print the log for a branch other than the current one?

TL;DR Use git log <branch> where <branch> is the name of the branch of interest. From the git-log man-page… A simplified version of the git-log synopsis given in that command’s man page is git log [<revision range>] Further down, you can find the following passage: When no <revision range> is specified, it defaults to HEAD … Read more

Git stash twice

You can get a list of all stashes with git stash list which will show you something like stash@{0}: WIP on dev: 1f6f8bb Commit message A stash@{1}: WIP on master: 50cf63b Commit message B If you made two stashes, then just call git stash pop twice. As opposed to git stash apply, pop applies and … Read more