GitHub/Fork/Local Git/Getting Giddified ...

  • Moderator

    Ok, someone with a way better understanding of GitHub/Git, please chime in here. Be warned, this is convoluted:

    • I have a fork of the main project (/MichMich/MagicMirror) on GitHub
    • From my PC, I pulled it down with GitHub and saved it onto a folder that’s shared FROM the rPi’s pi user account (where MM lives and runs from)
    • I edit on my PC, refresh MM from the rPi and when satisfied, push changes back into my fork of the project (see below why)
    • Every so often I will pull the upstream branch down and merge it with my own so I keep synced with the main project

    I also pull the same fork down at work, same setup, from a PC running GitHub, onto a shared folder running on a unix machine. I run MM from that unix machine, make edits on my PC, and when satisfied, push them back up to my fork. This also means that every day I resync my systems from my fork. If I make changes while at the office, I resync when I get home so my computer at home has those changes. When I get to the office in the morning, I resync so I get all the changes I made at home. I told you it’s convoluted, didn’t I?

    This works … except, when I create a pull-request, it pulls in every-little-detail. Like, each time I (re)synced with the main branch. Local .gitattributes file that I created and synced back up to my own fork. Here’s is an example of what it’s doing:

    Note the upstream merge commits, and the .gitattributes file create and delete … those are all being reported in the pull request. As well as some random filemode changes.

    So, without me losing my head completely, is there a better way to do a pull request where all of that extraneous crap isn’t there?

  • MagicMirror Creator

    @KirAsh4 cant help you here. Git is one of those guys I don’t dare to ask difficult questions. Always afraid that it will beat me up. 😂

  • Moderator

    Bwahahaha. Yeah, I think I’m going to have to ask the git community or on stackoverflow.

  • Moderator

    So the short answer is to squash my commits prior to syncing to GitHub. Easy enough … I have to remember to do it and only sync once per session, so like at the end of my work day, or at the end of the evening at home. That should then create a cleaner PR. This is to be tested next … after I get rid of the current fork that I have that has dozens of commits on a PR (because I synced dozens of times.) Get rid of it, refork, add my stuff back in, and then get a clean(er) PR done. Oy … headache.

  • MagicMirror Creator

    @KirAsh4 Do you do your Git work via the command line or are you using an GUI? I admit to use Tower for the more advanced work, and it really makes stuff more easy.

  • Moderator

    Mainly GitHub for Windows (which is a GUI). And it’s really only for committing my changes, and syncing them back up to GitHub (online, into my fork). The only time I drop to command line is when I need to merge the upstream repo (so I stay current with stuff that you merge in.)

    But the problem is that I have a tendency to push stuff up to GitHub (online) several times during the day, as opposed to just once at the end of the day. This then creates multiple commits in the PR. If I squash all of my commits into one, just prior to syncing, then the PR will only have 1 or 2 items in it, as opposed to one for every single commit I made throughout the day.

    It’s a matter of changing how I interact with GitHub, which I suspect would be the same no matter what application I’m using.

  • MagicMirror Creator

    @KirAsh4 Thats true indeed. I just admit. I work the same way as you: push every change! ;)

Log in to reply

Looks like your connection to MagicMirror Forum was lost, please wait while we try to reconnect.