pulling github back to local machine
Now that I had a clean slate in terms of my dev setup, I needed to pull my github changes back to my local machine. Currently my .git/config
looked like this:
[remote "origin"]
url = https://github.com/hyperkitty/hyperkitty.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
To pull my github changes (which I had forked from the main repo), I made these changes to .git/config
:
[remote "origin"]
url = git@github.com:/hyperkitty.git
fetch = +refs/heads/*:refs/remotes/origin/*
[remote "upstream"]
url = https://github.com/hyperkitty/hyperkitty.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
With these changes, I pulled down my code:
# pulls latest from main branch to local machine
git pull upstream master
# pull only grabs master, we must manually get other branches
git checkout -t origin/bootstrap-v3-overview
git branch # verify branch is pulled in and selected
# in case feature branch isn't up to date (it should be)
git pull
At this point, here’s a quick diagram of how my local git repo looks:
J - K - [lots of commits] - A - B - C - T [master] \ / - A - B - C ------------ [Alice's master] \ - G - H - I [my feature branch]
Basically, my feature branch was built off of Alice’s master branch. When I started working on my feature branch, Alice’s branch hadn’t been merged into the main upstream yet. But recently it was merged in and so now my feature branch can be incorporated too. So I started a pull request via GitHub, but did it a bit prematurely, because the feedback I got was that my branch should be rebased off of the updated head, which leads me to my next post…