git stash and apply

Quick “TL;DR” take-away version, so one can come back later and study more git stash hangs a stash-bag—this is a peculiar form of a merge commit that is not on any branch—on the current HEAD commit. A later git stash apply, when you’re at any commit—probably a different commit—then tries to restore the changes git … Read more

Pull is not possible because you have unmerged files, git stash doesn’t work. Don’t want to commit

git fetch origin git reset –hard origin/master git pull Explanation: Fetch will download everything from another repository, in this case, the one marked as “origin”. Reset will discard changes and revert to the mentioned branch, “master” in repository “origin”. Pull will just get everything from a remote repository and integrate. See documentation at http://git-scm.com/docs.

How to view stash date/timestamp next to stash id?

git stash list simply runs git log with a particular set of options: list_stash () { have_stash || return 0 git log –format=”%gd: %gs” -g –first-parent -m “$@” $ref_stash — } The $@ part inserts whatever additional options you’ve specified (none by default, but –date=relative in this case).1 When you use –date=relative this modifies the … Read more

automatically stash save/pop changes on git rebase?

Edit: As of Git version 1.8.4, but with an important side bug fixed in Git version 2.0.1, git rebase now has –autostash. You can configure git rebase to use –autostash by default as well, with git config –global rebase.autoStash true. Please note the following sentence from the documentation: However, use with care: the final stash … Read more