Wed Jul 27 16:31:04 CEST 2011
git: get branch without merging
When working with multiple computers, it seems best to not perform
merging automatically. I was working with 2 repositories (one on the
workstation, one on the laptop) and manually creating branches and
pulling from one repo into the other. This is error prone.
What I've found to work best is to name the external repositories
appropriately. That way they can first be fetched all at once which
eliminates the problem of forgetting some patches.
I.e. to import stuff from my laptop called "one", I have the following
in .git/config with ~/.ssh/config setup appropriately with the alias
fetch = +refs/heads/*:refs/heads/remotes/one/*
url = ssh://one/<absolute-path-to-repo>
Then "git fetch one" will fetch all branches from the laptop and put
them under remotes/one in my current repo. Then it's easy to pull or
branch from there.
For refspec info, i.e. in the line "fetch = +<src>:<dst>" see .