- 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
- 從零開始:數字圖像處理的編程基礎與應用
- Mastering RabbitMQ
- 我的第一本算法書
- 網店設計看這本就夠了
- 零基礎學Python數據分析(升級版)
- SSM輕量級框架應用實戰
- Mastering ServiceNow(Second Edition)
- 移動界面(Web/App)Photoshop UI設計十全大補
- Building Microservices with .NET Core
- 詳解MATLAB圖形繪制技術
- Learning Node.js for .NET Developers
- 遠方:兩位持續創業者的點滴思考
- Mastering Gephi Network Visualization
- Raspberry Pi Blueprints
- Learning Shiny