當前處於A分支,需要將此次的代碼提交至B分支則可以進行以下操作
在沒有進行commit之前可以進行一下操作
1、通過git stash將工作區恢復到上次提交的內容,同時備份本地所做的修改
git stash
2、然後切換至B分支
git checkout B
3、從git棧中獲取到最近一次stash進去的內容,恢復工作區的內容,獲取之後,會刪除棧中對應的stash
git stash pop
4、在進行正常的提交代碼步驟即可
git add /src/main/..
5、git commit -m "功能開發"
6、git pull origin 分支名稱
7、git push origin 分支名稱
記錄一下 yoo