git-stash

Delete all Git Commit History

删除回忆录丶 提交于 2021-02-17 08:55:51
问题 I am trying to fetch a repo from Github, revert a tag in past, push it to another remote with deleting all history. I can do everything with below except deleting all commit logs. What I am missing? git clone https://github.com/user/user-repo.git cd user-repo git reset --hard tags/v2.0 git remote add stash ssh://git@myserver:7999/myproject/user-repo.git git push --force stash master 回答1: I thought what you want is a repo like a new one, so deleting the .git/ directory and re-initing it will

How to list the parent commit of a stash in `git stash list`

对着背影说爱祢 提交于 2021-02-07 06:31:18
问题 When I generate a stash in git , there is a "parent" (the last commit before I stashed my changes). When I use git stash to stash my changes, an ID to that parent-commit is added to the message describing my stash. calling git stash list can e.g. show: stash@{0}: WIP on master: c09a3fc second commit stash@{1}: WIP on master: 063b893 first commit stash@{2}: WIP on master: 063b893 first commit But when I run git stash save "My own message" the ID of the parent-commit is not added ( git stash

How to ignore added hunks in `git stash -p`

白昼怎懂夜的黑 提交于 2021-02-06 10:08:40
问题 Imagine this scenario: # edit two files git add -p // add hunks from one file Now when you run git stash -p , it will again ask you whether you want to stash the hunks that you just selected via git add -p . Is there some way to configure git to ignore these already-added hunks by default? Most of the time, I don't want to stash stuff that I added already. 回答1: Okay, from comments, what's wanted is a stash of all changes that haven't already been added (whether excluded during a git add -p ,

How to ignore added hunks in `git stash -p`

﹥>﹥吖頭↗ 提交于 2021-02-06 09:59:05
问题 Imagine this scenario: # edit two files git add -p // add hunks from one file Now when you run git stash -p , it will again ask you whether you want to stash the hunks that you just selected via git add -p . Is there some way to configure git to ignore these already-added hunks by default? Most of the time, I don't want to stash stuff that I added already. 回答1: Okay, from comments, what's wanted is a stash of all changes that haven't already been added (whether excluded during a git add -p ,

Get git stash parent commit

瘦欲@ 提交于 2021-02-05 06:10:43
问题 Is there a way to retrieve the commit from which a stash was originally created? When creating a stash with the default command git stash the original commit is saved in the stash message, so it usually looks like: stash@{0}: WIP on master: abc123 This is the message of some commit. However, if git stash save 'a stash message' is used, the commit does not appear in the stash list: stash@{1}: On master: my own message So how could it be retrieved? 回答1: I'd say git log -1 commitish^ E.g. git

Get git stash parent commit

百般思念 提交于 2021-02-05 06:10:40
问题 Is there a way to retrieve the commit from which a stash was originally created? When creating a stash with the default command git stash the original commit is saved in the stash message, so it usually looks like: stash@{0}: WIP on master: abc123 This is the message of some commit. However, if git stash save 'a stash message' is used, the commit does not appear in the stash list: stash@{1}: On master: my own message So how could it be retrieved? 回答1: I'd say git log -1 commitish^ E.g. git

Get git stash parent commit

99封情书 提交于 2021-02-05 06:10:29
问题 Is there a way to retrieve the commit from which a stash was originally created? When creating a stash with the default command git stash the original commit is saved in the stash message, so it usually looks like: stash@{0}: WIP on master: abc123 This is the message of some commit. However, if git stash save 'a stash message' is used, the commit does not appear in the stash list: stash@{1}: On master: my own message So how could it be retrieved? 回答1: I'd say git log -1 commitish^ E.g. git

Can I git stash a merge in progress?

荒凉一梦 提交于 2021-01-22 00:36:22
问题 I'm in the middle of resolving conflicts for a git merge, but I want to get back to a clean state temporarily without losing the work I've already done on the merge. If I try to git stash, I get errors for each file for which a conflict has not yet been resolved: "needs merge". Is there a good way to save the merge-in-progress? The only idea that I have is to clone the repo into a different folder, but that seems excessive. 回答1: You could use the git worktree command to add a new worktree in

Why does “git stash push” cause “Unmerged paths: … both modified: …”?

折月煮酒 提交于 2020-11-29 03:55:52
问题 Q1: How can I reproduce this scenario? (I unsuccessfully tried to reproduce it) Q2: What does this Unmerged paths:... both modified:... state mean? I did a git stash (push) and got into an Unmerged paths: ... both modified: ... state, and I don't know why / what it means. My steps: modified a single file (I may have done a git add -p , and then might have modified the working tree copy (I don't remember)) $ git stash -m 'my message' $ git status Unmerged paths: (use "git restore --staged