git-stash

How can you tell if a git stash is no longer required?

感情迁移 提交于 2019-12-05 02:16:40
Is it possible to tell whether a stash has already been applied, and therefore is no longer required, without doing git stash apply ? Assume that I'm only using one branch. This could be prevented by using pop rather than apply when applying a stash, and therefore get rid of the stash each time it gets applied. However, I sometimes use git stash to keep a snapshot of work in progress, rather than only using it to switch from one task to another. Using pop would defeat that somewhat. Just make a diff and you will see. git diff HEAD stash@{0} You can use the following shell script to get git

git stash questions

守給你的承諾、 提交于 2019-12-05 01:30:19
问题 I am running msysgit 1.7.3.1. If I run stash apply, and there is a conflict, all of my stash changes get staged. Is this the correct behaviour? I found it a little surprising. Another question: if I have stashed 10 files, and there is a conflict in one of them, will stash apply abort when it has a conflict, or will it apply all non-conflicted files. Finally, if I do the following: git stash git pull git stash apply and another developer has removed a file that I have stashed, then I am unable

Turning off the pager in git for the stash command only

喜你入骨 提交于 2019-12-04 22:20:34
I generally like the use of the pager in git, but for git stash the pager annoys me. When calling git stash list , I don't want to be shown the three lines of output in the pager -- it forces me to press q just to make the output unavailable again when typing the folow-up git stash pop command. One solution would be to use git --no-pager stash list but that's to much typing (I'm lazy). Following the man page of git config , I tried git config --global pager.stash false but this doesn't seem to do what the documentation says (actually, I didn't notice any effect). Then I tried git config -

Git PathSpec Issue on Git Stash

◇◆丶佛笑我妖孽 提交于 2019-12-04 10:21:49
When I run the new version 2.13.0.windows.1 of its new command stash -p -- {pathspec} as git stash -p -- AB.Dir1/Dir2/DestinationHierarchyCreator.cs it reports the error error: pathspec 'AB.Dir1/Dir2/DestinationHierarchyCreator.cs' did not match any file(s) known to git. Yet when I do a git status , where I copied the file from actually , it reports Your branch is up-to-date with 'origin/project/develop'. Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: AB.Dir1/Dir2

git-stash unable to find work tree

我的未来我决定 提交于 2019-12-04 06:21:50
I'm trying to setup a git repository with a manually defined worktree via: cd /Users/braitsch/repos/project1 git --git-dir=. --work-tree=/Users/braitsch/projects/project1 init After running the above I can add files located in "/Users/braitsch/projects/project1" via : git add somefile or git add . Commits work fine as do calls to "git branch" However, git stash list throws the following error: fatal: /usr/local/Cellar/git/1.7.4.4/libexec/git-core/git-stash cannot be used without a working tree. Is stashing not supported in user defined work-trees? git config --local core.worktree echoes out :

why git stash cannot abandon the changes made just now?

好久不见. 提交于 2019-12-04 02:54:09
问题 i forked a project from github, and the origin point to my own github repo, remote point to its original repo, since i want to get update from remote, i use git pull remote branch_name, then my local repo is in conflict mode, now i want to cancel the effect of git pull, so i use git stash, but was surprised to find i failed to do this? what's wrong? the detailed info is as follows: [mirror@home weechat]$ git status # On branch master # Unmerged paths: # (use "git add/rm <file>..." as

How to recover the index after a git stash / git stash pop?

谁说我不能喝 提交于 2019-12-04 02:28:53
After adding some changes to the index with git add -p, I then issued a git stash but forgot to add --keep-index. Then I stupidly did a git stash pop, and all my changes to the index were gone. Is there a way to recover the index to the state before the git stash? When you've just done git stash pop , the last line in the output is: Dropped refs/stash@{0} (ca82a6dff817ec66f44342007202690a93763949) If you've lost it, see How to recover a dropped stash in Git? to find the commit hash. Once you have the hash, either : Drop all current changes (applied stash): git reset --hard And reapply the

How to pull into not-the-current-branch?

蹲街弑〆低调 提交于 2019-12-03 22:04:17
Say my current branch is myfeature. I want to get master up to date. Both git merge git pull always merge into the current branch, as far as I can tell. Is there a way to merge changes from a remote branch (eg, origin/master) into a branch I'm not currently on (master)? I can think of one way: git stash git checkout master git pull origin/master git checkout myfeature git stash apply Is there a better one? (It's possibly my whole question is wrong: would git fetch automatically update master to match origin/master, if remote-tracking is enabled?) You are correct that pull/merge only merges

When should I use git stash?

三世轮回 提交于 2019-12-03 18:24:31
问题 If I work on branch A and suddenly need to work on branch B before being ready with a commit on branch A, I stash my changes on A, checkout B, do my work there, then checkout A and apply the stash. If I work on A and I want to stop working for the day, should I stash my work and then apply it the next day, when I resume my work, or should I just leave things as they are - uncommitted modified files in the working directory. I don't see why I would need to use stash in this case, except if

git create stash without need to configure user.email and user.name (git stash --author ?)

。_饼干妹妹 提交于 2019-12-03 15:48:04
问题 IN SHORT Is there a possibility to create a stash (using git stash create ) without the need to configure user.email and user.name ? Something similar to the git commit --author option? SOME CONTEXT: I have several build machines on which I have a build user. Each has acces to the central git repositories. However I haven't configured user.email and user.name for each of those users; since they never need to make commits. In one of my scripts I use git stash create (which allows me to use git