Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Commit your changes or stash them before you can merge appears in Git. What's the solution?

Shulou Source: shulou.com Published: 2022-06-01 17:31:07 10月01日 Update

Commit your changes or stash them before you can merge appears in Git. What is the solution, I believe that many inexperienced people are at a loss about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

The following problems occur during git pull

The reason for this problem is that someone else modified the xxx.php and submitted it to the version library, and you also modified the xxx.php locally, so you can git pull the conflict. The solution is also very clear in the above tips.

1. The reform of retaining local modifications

Through git stash-this method is usually used

Git stash

Git pull

Git stash pop

Git stash: back up the contents of the current workspace and read the relevant content from the most recent submission to ensure that the workspace is consistent with the last submission. At the same time, save the contents of the current workspace to the Git stack. Restore the workspace to the last submitted content through git stash, back up the local changes, and then you can git pull normally. After the git pull is complete, execute git stash pop to apply the previous local changes to the current workspace.

Git stash pop: read the last saved content from the Git stack and restore the relevant contents of the workspace. Because there may be multiple Stash content, it is managed by the stack, and the pop reads the content from the most recent stash and restores it.

Git stash list: displays all backups in the Git stack, and you can use this list to determine where to restore from.

Git stash clear: clear the Git stack. At this point, using graphical tools such as gitg, you will find that which nodes of the original stash have disappeared.

Just enter these three commands.

After reading the above, you know that commit your changes or stash them before you can merge appears in Git. Do you know what the solution is? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Tags: Content workspace work methods problems backups methods reasons at the same time more faceted consistent helpless for this three commands graphics places multiple for this Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Huawei MySQL NVidia MariaDB