AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Git fetch vs pull origin8/27/2023 ![]() Git fetch origin master:master develop:develop uses refspecs with fetch to fast-forward the master and develop branches in your local repo. This way, if you're on master or develop, you detach your working copy from those branch pointers, allowing them to be moved (Git won't allow you to move the branch references while your working copy has them checked out). Git checkout -quiet HEAD directly checks out your current commit, putting you into detached head state. Git fetch origin master:master develop:develop \ Sync = "!sh -c 'git checkout -quiet -detach HEAD & \ You can set up an alias that uses git fetch with refspecs to fast-forward merge your branches with just one command. I would just prefer a builtin solution if it exists :) ![]() My goal was not to discourage or frown upon script/alias customizing of git. But I want to avoid that if possible, as it is error prone and not very efficient.Įdit: ok let me rephrase that. I know I can make aliases/scripts that does these steps. and then git pull again, and then switch back to develop, to get the desired result. Your branch is behind 'origin/master' by 106 commits, and can be fast-forwarded. Remote: Total 70 (delta 29), reused 28 (delta 8)ĥ386563.902fb45 develop -> origin/developĪll the remote branches are fetched, but only the branch I'm currently on is merged with its corresponding remote branch. ![]() Remote: Compressing objects: 100% (56/56), done. ![]() When I do git pull now I get something like this: remote: Counting objects: 92, done. Is it possible to specify that I want both master and develop to be merged(fast-forwarded) at once? In a repo I have multiple branches, among them "master" and "develop", which are set up to track remote branches "origin/master" and "origin/develop". ![]()
0 Comments
Read More
Leave a Reply. |