You are reading a single comment by @charlie and its replies. Click here to read the full conversation.
  • I have some dumb questions with regards to github that I am hoping someone can straighten me out on.

    PROBLEM #1

    When I started developing on Bangle, I understood basic git commands but could
    not find out how to update a fork of the master Bangle repo through the github website GUI. I looked in the docs but could not find out how once you had created a fork you could update it through the github website.

    Everytime I made changes I had to create a new branch on github add my change so that I had a repo that was up to date and do a pull request. After a while I realised I could work as follows.

    I cloned the BangleApps (call it upstream) repo to my github user account (my fork)

    I then cloned my fork onto my ChromeBook linux setup using git clone https://github.com/hughbarney/BangleApps.git. This is now my local repository.

    I update the Chromebook/BangleApps (local) using git fetch upstream where upstream
    is setup using
    git remote add upstream https://github.com/espruino/BangleApps.git

    I merge in any changes using git merge upstream/master

    I make my changes and get my app working
    when done I push it to my github account (the fork) using git psh origin master
    This allows me to test the app will install through my own loader.
    I then manually request a pull request through the github website to BangleApp

    Now all this is because I could not figure out what the github website GUI actions are to update a fork after ot has got out of date.

    So there must be a better way. Can anyone show me where the 'Update' button is on a github repo.
    If you could speak in screenshots and I could not find a useful decription of how this is done.

    PROBLEM 2

    After doing a pull request - there seems to be a review process and someone else
    changes your pull request (Change#1) and and then asks you to make some more changes.
    Where does the changed code for (change #1) now live. Is it in my forked repository ?

  • From your comments I will add my thoughts on what helped me, as I remember when I first started using source control it took a while to get my head around it.

    1. Git and Github are two separate things (I think you already know
      this but pointing it out anyway). Git is the source control, it
      doesn't know anything about github - but provides generic functions for handling remote repos. Github provides a place to remotely host your sources + loads of other tools
    2. Use Github desktop or a third party tool to help with git. If you use an IDE they usually have plugins available. This will help with change merges (Problem 2).
    3. Having a graphical view of branches really helped me to understand the branch and merge process (see my screenshot from Webstorm).
    4. Having a merge tool where you can see your version, the other version and the resulting version side by side makes a huge difference. Git does have a built in merge tool, but its rubbish - but you can set it to use a third party one.
    5. Pull the latest master branch into your branch as often as you can. The further away from the latest version you have, the harder it will be to merge them later on.

    When you are looking for a better process, merging branches is notoriously problematic. Merge tools can auto merge most stuff, like taking someone else's version of a file you haven't changed. However if you change a file and then try and merge another branch into yours but you have changed the same file as someone else, its hard for a merge tool to know which bits of which file you want to keep. If you make sure everytime you start working on the project you pull the latest and merge it into your branch the merge tool will be able to do alot more auto merging.


    1 Attachment

    • git_diagram.png
About

Avatar for charlie @charlie started