git-stash

Undo git reset --hard after git stash pop

蓝咒 提交于 2019-12-10 16:24:45
问题 I had some changes in the stash that I attempted to recover using git stash pop . There were some merge conflicts, and rather than resolving them, I decided to just reset it. Unfortunately, in a moment of stupidity, I did a git reset --hard , and now all of the previously stashed changes are gone. Is there any way to recover these changes? I've tried git fsck --cache --no-reflogs --lost-found --unreachable HEAD , but none of the commit hashes listed refer to the changes I need. What else can

Move uncommitted changes from current branch to another branch that conflicts with those changes

a 夏天 提交于 2019-12-10 10:48:16
问题 Suppose I am on branch master and I start making some changes. I make the changes to a file which is already opened in Emacs (so under the hood, as checkouts happen, Emacs is unaware unless I revert-buffer constantly). The file did exist in branch other_branch which was intended to be merged into master later on. But the file did not exist in master until I accidentally saved it from Emacs. The changes are uncommitted, but I realize that I shouldn't have been making the changes on master and

Git alias with two commands (stash pop + merge) executes only the first command. Why? How to execute also the merge?

那年仲夏 提交于 2019-12-10 03:05:55
问题 I set up a git alias like this: git config --global alias.popmerge '!git stash pop && git merge master' Then I call it, like this: git popmerge The " git stash pop " is executed, but the " git merge master " is ignored. If I run " git merge master " right after the " git popmerge "... it sumply runs as expected, performing the merge. I have other aliases with long sequences of commands... and they run flawlessly. It seems something at " git stash pop " makes the alias process to halt ... Is

How to remove range of git stash?

僤鯓⒐⒋嵵緔 提交于 2019-12-09 02:49:36
问题 I want to remove all stash'es, except most recent, from git stash list . E.g. I want to remove stash 1 to 3 in a single git command: stash@{0}: On master: Test related changes stash@{1}: On master: Tets stash@{2}: On master: Integrate bunyan logging and http2 stash@{3}: On master: Integrate bunyan logging and http2 I checked this answer https://stackoverflow.com/a/5737041/3878940, but its applicable to delete only a single stash. Is there any git command to delete a range of stash es? 回答1:

How to git fetch by branch creator from stash

蓝咒 提交于 2019-12-08 18:25:31
when I use the command: git fetch I am getting all the branch created on the remote which are not on my local machine. But I only want to fetch the remote branches that I created myself. VonC By default, the refspec associated to an upstream repo is [remote "origin"] url = https://github.com/schacon/simplegit-progit fetch = +refs/heads/*:refs/remotes/origin/* That is why you are getting many remote tracking branches. You can modify/add new refspecs for the fetch, as seen in " Can I specify in .git/config to fetch multiple refspecs? ". If you have a naming convention which allows you to

git stash while amending last commit (in gui) - pop pops nothing

蹲街弑〆低调 提交于 2019-12-08 06:19:28
问题 So I had some unstaged changes and some staged ones. I issued Welcome to Git (version 1.8.3-preview20130601) $ git stash save --keep-index Saved working directory and index state WIP on master: ab0d18d Setup of alarms f or network service + Logging exceptions + long arithmetic HEAD is now at ab0d18d Setup of alarms for network service + Logging exceptions + long arithmetic $ git stash Saved working directory and index state WIP on master: ab0d18d Setup of alarms f or network service + Logging

How to git fetch by branch creator from stash

泄露秘密 提交于 2019-12-08 06:01:43
问题 when I use the command: git fetch I am getting all the branch created on the remote which are not on my local machine. But I only want to fetch the remote branches that I created myself. 回答1: By default, the refspec associated to an upstream repo is [remote "origin"] url = https://github.com/schacon/simplegit-progit fetch = +refs/heads/*:refs/remotes/origin/* That is why you are getting many remote tracking branches. You can modify/add new refspecs for the fetch, as seen in "Can I specify in

Applying stash changes in git, where the stash contains files that has been moved

橙三吉。 提交于 2019-12-07 16:45:44
问题 My current branch has moved certain files to different folders, and the stash created had made changes to the files which were located in the old folders. How to properly apply the stash without breaking anything, and would like to know the easiest method for this. 回答1: I see a few simple steps to do: Move some files, only those that are required by a git stash show , back to old place: git mv file old_place/file Apply stash to those files: git stash pop Merge the changes, if any: vim ... git

Can't discard changes in git

倖福魔咒の 提交于 2019-12-07 13:11:32
问题 A week or two ago I took some files that I had been archiving with a simple find |sed|tar|xz|gpg bash script, unpacked them all, and put their contents in a git repo, commited, put the next archives content in the repo, committed (rinse and repeat) in order to have a nicer system. All files were edited with on one of my two computers, both using Arch Linux, in either TeXstudio or Vim. I tried to checkout an old version, but its flipping out---it won't let me due to changed that are

git stash while amending last commit (in gui) - pop pops nothing

不问归期 提交于 2019-12-07 08:48:30
So I had some unstaged changes and some staged ones. I issued Welcome to Git (version 1.8.3-preview20130601) $ git stash save --keep-index Saved working directory and index state WIP on master: ab0d18d Setup of alarms f or network service + Logging exceptions + long arithmetic HEAD is now at ab0d18d Setup of alarms for network service + Logging exceptions + long arithmetic $ git stash Saved working directory and index state WIP on master: ab0d18d Setup of alarms f or network service + Logging exceptions + long arithmetic HEAD is now at ab0d18d Setup of alarms for network service + Logging