I’m a hobbyist and butcherer of python code. Quite often i’m jumping between multiple laptops / desktops playing around with different projects. Just wondering what the best workflow is or suggestions people have around syncing projects so I can edit and work on projects regardless of the computer. Is this something that people generally manage through github?? Thanks in advance for the thoughts!

  • rompe@feddit.org
    link
    fedilink
    arrow-up
    1
    ·
    18 hours ago

    One more thing regarding Git:

    You’ll likely want to keep your main branch functional at all times, so you would normally wait with your commit and push until a feature is ready. This wouldn’t mix well with switching machines at random times.

    That’s where branches come in handy: create a feature branch, commit and push as often as you want. If the feature doesn’t happen to work out, just delete the branch. When the feature is ready, merge the branch into the main branch. There even is an option to squash commits into a single one when merging, so you don’t have to keep the whole commit history you created in the feature branch.

  • sip@programming.dev
    link
    fedilink
    arrow-up
    3
    ·
    1 day ago

    code goes in git which you can push to other devices and pull from other devices. but if you’re not used to it and you turn off a machine and forget to push… you’re stuck.

    for syncing files in general, I use syncthing. open source, e2e encrypted.

    • Gamma@beehaw.org
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      2 days ago

      codeberg requires everything to be open source and only allows private repos that support open source projects

        • hoppolito@mander.xyz
          link
          fedilink
          English
          arrow-up
          2
          ·
          edit-2
          2 days ago

          You can have a couple of private repos on codeberg no problem, it’s just that if you start using a lot of HDD space for them without also contributing stuff that they don’t like it

          So it’s technically true that if you never contribute to any projects they don’t love private repo-only accounts, but it’s a pretty relaxed rule.

          Nevertheless a good list of other forgejo instances is e.g. here.

  • towerful@programming.dev
    link
    fedilink
    arrow-up
    6
    ·
    2 days ago

    Git. Git git git.
    If it is text and can be modified from multiple places, should have a single “main” branch and feature work done independently on separate “branches”. Or even just a “back this up”.
    Git.

    Git is text based version control (tho it will do binary file, just not elegantly).

    So yeh, git.
    GitHub is easy to host on, but owned by Microsoft and is somewhat proprietary (by the time issues and other enhancements GitHub provides), but at the end of the day it is git with authentication and is on the ol “cloud”.
    Plenty of ways to replicate this if it’s just for you

    • YeahToast@aussie.zoneOP
      link
      fedilink
      arrow-up
      3
      ·
      1 day ago

      Thanks for your reply, I definitely have to look up the best practices for git storage / branches etc as I have no idea. Pretty keen to distance myself from Microsoft where able.

  • Midnitte@beehaw.org
    link
    fedilink
    English
    arrow-up
    20
    ·
    2 days ago

    Yes, using a remote code repository (i.e. git) - plenty of options aside from github.

    Merely git pull the repository to whatever machine you want to work on and commit the changes back (rinse, repeat)

    • YeahToast@aussie.zoneOP
      link
      fedilink
      arrow-up
      2
      ·
      1 day ago

      Ok perfect, thank you! I’ll have to spend a bit of time learning best practice around git. Thanks for the prompt about GitHub alternatives.

    • YeahToast@aussie.zoneOP
      link
      fedilink
      arrow-up
      2
      ·
      1 day ago

      Perfect thank you. I haven’t quite got a home server up and running yet, but am trying to keep things stored locally. Will look into it, thank you

  • 14th_cylon@lemmy.zip
    link
    fedilink
    arrow-up
    10
    ·
    2 days ago

    yes, it is something people generally manage through git. github or gitlab (if you want to avoid microsoft)

  • RonSijm@programming.dev
    link
    fedilink
    arrow-up
    3
    ·
    2 days ago

    I don’t think this has been mentioned, but it kind of depends on where your multiple laptops / desktops are. Is this always on your own home network? Because in that case you don’t even need a remote service like Github

    If so, you can create a network drive on any of the devices - mount the network device on your other devices, and then create a local git repo there. Just remember that using an external git service is also a backup. So if you do everything locally, make sure to have your own backups in place

    A much, much worse but also possible solution is to just put your projects into onedrive/dropbox/gdrive and sync it everywhere. It works for syncing, since you’re saying that’s the main objective - but you lose out on version control

    • YeahToast@aussie.zoneOP
      link
      fedilink
      arrow-up
      1
      ·
      1 day ago

      Thanks for your reply. I’ve started using tailscale so I think that could help re: remote access. An interesting thought about a shared network drive though… I’m not yet at a point where I’ve got a server running 24/7 but I will be at some point (when RAM and storage stop killing me), which I think could be a good option outside of git

  • swicano@programming.dev
    link
    fedilink
    arrow-up
    3
    ·
    2 days ago

    I’ll add one more perspective: git is the “right” way to do it, but I’m a lazy forgetful person who wants to work on the laptop but the changes on the desktop aren’t committed or pushed remote. What I often do is to use VScode’s remote development tools to open a remote connection the last computer with uncommitted changes, and work like that. If I’m headed out, I’ll use the remote connection to commit the code so I can access it off my home network via codeberg.org.

    Occasionally if I’m already out, I’ve even used “raspberry pi connect” to remote onto my network, then ssh over to my desktop, then commit and push. Don’t do that though. That’d be irresponsible.

    • YeahToast@aussie.zoneOP
      link
      fedilink
      arrow-up
      1
      ·
      1 day ago

      Thanks for your reply . I’ve started using tail scale and rusk desktop for my remote access although I’m still fumbling through it.

  • fruitcantfly@programming.dev
    link
    fedilink
    arrow-up
    2
    ·
    2 days ago

    I use Mega(sync) to keep my various PCs in sync. Before that I used SpiderOak for a number of years, but the service started degrading at some point, which forced me to switch.

    While committing to a git host is not a bad idea, it doesn’t cover all the stuff you might want to sync in my experience

  • Michal@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    2 days ago

    I used to use Dropbox for this, and it works, it’s automatic, so you’ll have the latest copy without manually pulling changes.

    However, for any non-throwaway code i use git now. It gives me granular edit history via commits, branches for experimental changes, and i can push it to github where i can run tests and deployments for free. However if you’re using git, you still need to run commit, push, pull commands but if you use an IDE or even a modern editor, it’ll have hot keys for it already.

    Also there are files you’re not supposed to commit, like binaries and 3rd party dependencies so you may need to setup a virtualenv and run pip install on each machine independently.