git一次套用多个存储

问题描述 投票:0回答:1

我有两次存储,我需要在一次提交中提交两个存储。

我使用git stash apply来应用最新的存储,但是当我再次使用它时,它会抛出错误,

error: Your local changes to the following files would be overwritten by merge:
        library/HQ/groupsql.sql
Please commit your changes or stash them before you merge.
Aborting
The stash entry is kept in case you need it again.

我如何弹出这两个存储区然后提交它们。

git git-stash
1个回答
0
投票

我认为您可以执行以下操作:

// to see the list of "stashes" (like every time when stash run 'git stash' a new entry is created in the list
> git stash list

// Lest assume you need stash@{1} and stash@{3} for the sake of example

> git stash apply stash@{1} 
git commit -am "Whatever message"

> git stash apply stash@{3}
git commit --amend  // to add changes from stash3 from the previous commit

底线,每个存储区一旦应用,就会在本地分支上产生提交,但是您可以更改历史记录,只要更改是本地的(不推送)

© www.soinside.com 2019 - 2024. All rights reserved.