Branches/Pulling/Github questions for a newbie

Posted on
  • Hi,

    I'm a bit new to this github thing.
    I forked the repo and now I see 2 branches to choose "master" and "espruino-master". I made some changes to my code and I think I was in "master". Now I tried to pull changes at the original repo, but I can't. It says "This branch is 353 commits behind the upstream and has conflicts that must be resolved.".
    I opened a "pull request", I think that means, that my changes are going to be merged into the original repo and then I can pull again.
    My changes are very subtle. Is there a way to get back to the "current state" of the original repo, and do my changes there, so I can keep up to date with Gordon's changes?
    Or... I mean... I'm a bit lost how to work with github.

  • Same! Worked this out just last night.

    Have you tested 'Fetch upstream' when in your forks 'master' branch?

    If that doesn't sort it for you, I'd say do:

    1. Create a new branch in your repo 'mybackup' from the branch you've made commits/changes to ('master' in your case) . (Select branch 'master' -> then enter 'mybackup' in the text input field -> 'Create branch: ...')
      Or/and download your fork repo as zip.

    2. Set up git and gh (github) in your terminal/command line.

    3. Take inspiration from this medium article: How to reset your git branch to a previous commit (both local and remote)

    4. Maybe keep your 'master' branch pristine and create a new one where you work on your 'subtle changes'.

    5. Get files you added/modified from backup and paste them back into your new branch (or 'master' branch).

    There may be a better way to go about it - but this worked for me.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Branches/Pulling/Github questions for a newbie

Posted by Avatar for gfric @gfric

Actions