For some time now I’ve been building and flashing locally.
Occasionally I run…
git fetch
… in the 3 repositories (core-common-lib, core-communication-lib and core-firmware) to ensure I’ve got the latest versions of everything (or I at least thought that was what I should be doing), but this seems to becoming more unstable recently.
I’m no git master (at all!) so I am now questioning whether I am doing things right / looking at the right (i.e. most stable) ‘branch’.
Is anyone good with git that could help me out?
I really want to know…
Which branch I’m currently looking at when I run git fetch? (master ?)
Which branch is the most stable? (origin/compile-server2 ?)
How should I switch branches, so that my local copy is the most/more stable?
I think you want to be doing a git merge master after you do a fetch, or just do a git pull. To see where you are, you can type git log after you do a pull to see what commits are included, and you can show branches and what branch you’re on with git branch, or switch to a branch with git checkout compile-server2 etc. Hope that helps!
No worries, if you checked in your changes (which you must have before switching branches), then nothing is lost, you can just git checkout master to get back to the other branch, or you can merge specific commits over with a git merge <<commit-hash>>>
You can also do a fancy git thing by marking compile-server2 as an upstream repo --> checkout the ‘configuring remotes’ section here: https://help.github.com/articles/fork-a-repo
I think with an upstream configuration, the workflow is closer to:
git fetch upstream
# Fetches any new changes from the original repository
git merge upstream/compile-server2
# Merges any changes fetched into your working files