- Continuous Integration,Delivery,and Deployment
- Sander Rossel
- 412字
- 2021-07-02 15:42:17
Pulling and stashing
That leaves us with the final part of the Git basics, pulling code from the server. Whenever your coworkers push code to the server, you want to get it from there on to your own computer. You can pull code using the git pull command. Just like when you push, a pull can result in a merge conflict. Whenever this happens, there are two things you can do. You can either commit your current work, pull the code from the server, and then resolve the conflicts. Or you can stash your changes, meaning you put them aside for the time being and reset all the files as they were when you last pulled, and then do the pull and apply your stash over the newly pulled code. A conflict between your current code and the stash will still occur, but you can now resolve it manually before committing your code.
Stashes are an easy way to put some code aside, either because you want to pull from the server or because you want to try some alternative solution to a problem without losing your current solution. It is good to notice here that new files in your repository will not be stashed; they will simply continue to exist in your current working directory. You can create a stash using the git stash command. You can optionally give your stash a name. You can then apply any stash you like or apply and delete your latest stash or any other stash by index. Try committing a file, then change and save its contents, and see what happens to it after each of the following commands:
git stash
git stash pop
git stash save "My awesome stash"
git list
git stash apply 0
git stash drop 0
- 深度學習經典案例解析:基于MATLAB
- Hadoop+Spark大數據分析實戰
- Java Web應用開發技術與案例教程(第2版)
- Keras深度學習實戰
- Tableau 10 Bootcamp
- jQuery炫酷應用實例集錦
- 區塊鏈技術與應用
- Java高并發核心編程(卷1):NIO、Netty、Redis、ZooKeeper
- Python Interviews
- 從零開始學Android開發
- Java程序設計實用教程(第2版)
- MySQL數據庫應用實戰教程(慕課版)
- JavaScript Mobile Application Development
- 軟件自動化測試實戰解析:基于Python3編程語言
- Python輕松學:爬蟲、游戲與架站