In order to have access to your friend's branch, first you need to fetch them from the remote repository to your local repository with:
git fetch --all
This pulls any branches from the remote repository that don't exist locally and adds them to your repository. Once you've done this, all you have to do is merge his branch into your branch. Assuming you're on your branch (if not just run git checkout c
), just run
git merge a
And accept the merge commit that pops up. As far as, "The other thing I do not quite understand is how I can work on my own branch", I think you're misunderstanding some very basic fundamentals of git, and I would highly recommend that you read through the docs to give yourself critical knowledge. Basically though, the idea with git is that you have a local repository, that has a set of data at any given time, and potentially any number of remote repositories that also contain a set of data that may differ from yours depending on when you last synced your local repo with any remote repos.
You should only run git remote add xxxx
once; when you want to add a remote repository (xxxx) for future usage. Your local repository already knows it exists (see <your project root>/.git/config
), so you don't need to run that again. What you need to do is:
- Add a new file to your local index:
git add blah.h
- Commit that file to your local repository:
git commit -m "some changes"
- Push your updated branch to the remote repository:
git push origin c
Does this make sense? If not, you really, really need to do some more reading on the absolute fundamentals of git. You've made a very good decision to start using git, but it sounds like you have some more digging to do before you're able to use it effectively.