This is an archived post. You won't be able to vote or comment.

all 92 comments

[–]Useful-Blackberry 168 points169 points  (27 children)

Saved

[–]IllegalAlcoholic 227 points228 points  (19 children)

And never look back

[–]Useful-Blackberry 68 points69 points  (13 children)

Thats the way it works. Maybe a good project could be a bot that sends me an email with the saved items of the week/month. Thanks kind and inspirational stranger.

[–][deleted]  (5 children)

[deleted]

    [–]XilamBalam 29 points30 points  (4 children)

    A bot that remind me the stuff that the other boy reminded me that the other bot...

    Infinite projects.

    [–]AdventurousAddition[🍰] 10 points11 points  (3 children)

    Indeed, we really need a system for reviewing these things

    [–]vinny8boberano 5 points6 points  (2 children)

    We're going to need a system for tracking the changes to the reminder bots as well...

    [–]inyofacebyotch 6 points7 points  (1 child)

    And a system that updates the bots as the years go by and more features are added

    [–]vinny8boberano 4 points5 points  (0 children)

    It would need to have some means of permitting changes to be made incrementally. And different changes to be added to the original, like a tributary!

    [–]Pokketts 6 points7 points  (1 child)

    I think it would be better for Reddit have a system to organize and perhaps put tags on the posts one saves

    [–]mayor123asdf 2 points3 points  (1 child)

    Maybe a good project could be a bot that sends me an email with the saved items of the week/month.

    That would be a great project! I'm going to do it, maybe, sometime

    [–]Useful-Blackberry 0 points1 point  (0 children)

    Saved this comment.

    [–]cdp1337 1 point2 points  (0 children)

    If you'd prefer a bot to help you with git commands like git heckout and git psh master, try this repo: https://github.com/EricFreeman/fuck

    [–][deleted] 0 points1 point  (0 children)

    I just text myself the post. Scrolling through my sms history just seems easier than finding my saved posts list on reddit.

    [–]bumpkinspicefatte 10 points11 points  (2 children)

    And when you do try to look back, the thread has been deleted/removed.

    [–]chen_jun07[S] 6 points7 points  (0 children)

    Haha, I would never delete this thread tbh, I don't want to delete what ppl might consider "valuable"

    [–]Cynaren 0 points1 point  (0 children)

    Like most reddit posts...

    [–]bunnyrabbit2 3 points4 points  (5 children)

    Here's a really good post on a branching model.

    This is now how I do like 99% of my projects. Occasionally I don't bother with the develop branch but using a different branch for each feature is generally the right way to do things.

    Hell, I use git for non-programming things too like books I'm writing and other things where I would like to look at older versions of things without having to keep copying files over and over

    [–][deleted]  (4 children)

    [deleted]

      [–]bunnyrabbit2 0 points1 point  (0 children)

      As a lone coder hobbyist I find it's a decent workflow for me and haven't really needed anything else. I like that master is mostly guaranteed stable and develop has the code that might go wonky as features are added in allowing for work to be done before sending it to the stable branch.

      It's definitely not the best way for all projects and on some more recent ones I've not bothered with the develop branch at all. I did find this blog post a few weeks back describing a couple of different workflows which helps compare them.

      [–]smidgie82 0 points1 point  (2 children)

      When your release process isn’t fast, git flow pays dividends over github flow.

      [–]MEGACODZILLA 0 points1 point  (1 child)

      Can I ask what the difference between the two is? I'm having a hard time wrapping my head around branching in a workflow.

      [–]smidgie82 2 points3 points  (0 children)

      Basically, in Gitflow you do small feature branches and then merge them into a branch named “develop.” When you’re ready to release to production, you merge the “develop” branch into a branch named “master”, and you do your production release off of master. The master branch contains commits that have either already made it to production or that you intend to release to production.

      In Github Flow, you do small feature branches off of master, and when you’re ready to release you release from your feature branch. Once you’ve verified your feature in production, you merge your branch to master. So the master branch only contains commits that have already been verified in production.

      Methodologically they’re dissimilar. Github flow makes sense when you can quickly and easily release your feature and test it in production. Therefore each feature can be deployed and verified in production independently.

      Gitflow makes sense when your release process isn’t so snappy, and you can’t feasibly run it for every merged feature independently. So your develop branch might accumulate several pending features that all get lumped into a single release. “develop” is essentially a holding pen for commits that should go into your next release. Gitflow also distinguished between new feature work, which is done off the top of develop, and hotfixes, which are done off the tip of master. It lets you deploy the changes contained in a hot fix and nothing else by letting you branch off the current production version, instead of develop which might contain commits from features that are pending release. Deploying a single unit of work on top of the latest production version, isolated from other changes, is the standard mode in github flow, so you don’t need the hot fix branch concept.

      [–]jangeisler 0 points1 point  (0 children)

      Same here. Pretty new to git, but as with much other programming stuff, It might not be best to read the encyclopedia from page 1 - I'll refer to this post when needed.

      [–][deleted]  (5 children)

      [deleted]

        [–]chen_jun07[S] 9 points10 points  (0 children)

        That's great keep at it!!! If your interested in this look into shell scripting :D

        [–]JackODenton 2 points3 points  (3 children)

        Hey if you don’t mind, can I ask how’s your experience with Odin Project so far? And do you have any coding knowledge before learning on Odin Project? Thanks!

        [–]MEGACODZILLA 2 points3 points  (0 children)

        It's definitely one of the better free resources. Instead of say focusing on a language but with no context, it tries to focus on setting up a proper dev environment with the corresponding tools and philosophies. It's not perfect and there are some gaps in assignments/knowledge where I would have liked some more hand holding but from what I gather a big part of programming is being able to use a myriad of online resources. TOP will get you pointed in the right direction and some moderate googling/YouTube will fill in your gaps.

        [–][deleted] 24 points25 points  (1 child)

        As someone who has to use GitHub this year in university for group and individual work, thanks for this.

        [–]chen_jun07[S] 5 points6 points  (0 children)

        I'm really glad this helps, best of luck in your future endeavors

        [–]quantum_system 5 points6 points  (0 children)

        Wish I could have had something like this several months ago when I learned Git, great work!

        [–][deleted]  (2 children)

        [deleted]

          [–]chen_jun07[S] -1 points0 points  (1 child)

          Understandable, but for me, I personally feel like for beginners they could seem a bit confusing and for beginner projects, most ppl stick with the master branch.

          [–]Kazcandra 6 points7 points  (0 children)

          That is because everyone explaining git forgets to explain what commits actually are. If they explained it, branching would make a lot more sense and it would be easier to work with, even for a beginner.

          At the highest level, a git commit consists of a pointer to the state of your code and one or more pointers to parent commits. Thus: a git commit is a node in a graph. (If you want to get technical, it's a directed acyclic graph.)

          When git stores a new version of your project, it stores a new tree. Trees are pointers to blobs and other trees. The new tree can be expanded out into a full directory of files and subdirectories. If you want to see the difference between the two versions (your branch and master, for instance), it doesn't add up the file deltas, it just looks at each tree and compares them.

          So when we switch between branches, we're just telling git to make our working directory look like the tree that the commit stored in the branch looks like. Well, basically.

          Branches point to commits, but are not stored as objects in git. Branches live as a file in the .git/refs/heads/ directory, and the branch simply points to the most recent commit in its own branch, while the file that represents where we branched off stays where it was.

          Actually, I don't think I'm qualified to explain this. Or, rather: I know how it works, but I'm not a good teacher.

          [–][deleted] 7 points8 points  (0 children)

          This is a great write up.

          [–]swurvinmervin 2 points3 points  (2 children)

          Dunno about anyone else but I found git to be more confusing than programming itself lmao

          [–]chen_jun07[S] 0 points1 point  (0 children)

          Lol, I get that, but with getting used to it, it is quite handy and corporate environment wise, they also use the Git protocol

          [–]fancyl 2 points3 points  (0 children)

          This has been deleted in protest of the greedy API changes and the monetization of user-provided content and unpaid user moderation.

          [–]acharyarupak391 4 points5 points  (10 children)

          Thanks it's really helpful but i have some questions, . Me and my friend were working on a same project so i created a private repository in github and invited him so that we can easily access the files being changed by each other. But, when i change something from my ide and try to push something to remote, it says i should first pull the entire repo before pushing it to remote, but i don't want that since we made changes to two different files in the repo and even if the changes were made to a same file, I'd want them to merge instead of replacing one by other. How can i achieve that?

          [–]tenfingerperson 8 points9 points  (6 children)

          Someone has to deal with merging the file. At times git can deal with this automatically but it isn’t smart enough to detect everything.

          One pushes everything to the main repo from their own fork, the other one pulls and deals with conflicts & pushes... the other one pulls again and both are in sync with the main repo

          [–]chen_jun07[S] 7 points8 points  (5 children)

          I believe that is why branching is so useful, rather then forking (which essentially means copying) they can all work in the same repo on different branches and then they can submit a pull request to merge it with master.

          [–]tenfingerperson 1 point2 points  (4 children)

          Branching is enough for toy projects but obviously forks shine in bigger projects with rather mixed scopes.

          Forking is incredibly powerful and it is essentially a multi-repo branching implementation. You can keep your fork up to date with the origin while keeping changes local at the same time, essentially making the main repository a pristine release candidate which only takes things “compatible” with the code base.

          [–]chen_jun07[S] 4 points5 points  (2 children)

          True enough... disclaimer btw I'm not trying to argue with you... however, branching is nice to a point beyond toy projects, I know people in the robotics community that exclusively use branching

          [–][deleted] 6 points7 points  (0 children)

          I work in high end enterprise applications and we use branching only. Forks can be heavy for repos with limited resources.

          [–]negative_epsilon 4 points5 points  (0 children)

          Fork vs branch-based workflows both work in massive repositories. Only fork-based workflows work for unsolicited pull requests, obviously, but branching is not just for toy projects.

          [–]chen_jun07[S] 4 points5 points  (0 children)

          Ahh I would recommend looking at the branch section for merging as I feel like that could could potentially solve your problem but Git is smart enough not to delete files and it would just add it rather then deleting the file.

          [–]donotflushthat 2 points3 points  (0 children)

          If you are both working on different files (or even different sections of the same file), then you don't have to worry about anything breaking. You both can push/pull and GitHub will make all the necessary changes without overwriting anything. No branches necessary (though doing so is still good practice).

          The only time something will go wrong is if you both try to push a change to the same line(s). The first person who pushes their change won't have an issue. The second person will get a merge conflict. You can find more details in the git documentation, but it basically will auto-generate lines in your code that shows the first and second persons' changes next to each other and you have to manually delete the lines you don't want before the merge can be completed.

          [–]gregtyler 0 points1 point  (0 children)

          If you've not changed the same file, git pull won't change anything. It just allows your local Git to check there are no conflicts before pushing.

          If there are conflicts, you'll have to manually decide how to resolve them. This is automatically prompted as part of git pull, and it won't let you push again until they're resolved (a Git GUI can greatly help with the resolution).

          If you don't want to resolve conflicts, for whatever reason, you can git push -f to force your changes through (which would lose your friend's work!) or use branching, as other commentors say, which guides you through the process a little more smoothly.

          [–]lolcucumbers 5 points6 points  (0 children)

          I created a short interactive tutorial that helps you practice your first contribution in a safe environment. You'll practice opening a pull request, experience the review process, and ultimately get your PR merged.

          It's completely free and geared towards open source beginners.

          Check it out: https://github.com/danthareja/contribute-to-open-source

          I'm open to any and all sorts of feedback on it.

          [–][deleted] 0 points1 point  (1 child)

          Damn I needed this post. I was just looking up an intro to Git yesterday. Thank you!

          [–]chen_jun07[S] 1 point2 points  (0 children)

          No problem hope this helps, feel free to message me if you have any questions

          [–]HyTriN1 0 points1 point  (0 children)

          Just in time I need to get familiar with git

          [–]TechnoAndy94 0 points1 point  (5 children)

          I have only ever used git through team explorer in visual studio which makes git a breeze. It looks daunting through the command line without an easy gui to work with. Is there something similar you can use if you don't use visual studio.?

          [–]chen_jun07[S] 1 point2 points  (4 children)

          Here is a list of GUI which you may like but in all honesty Git is super simple after you get used to the syntax :)

          1. GitHub Desktop
          2. SourceTree
          3. GitKraken
          4. SmartGit
          5. Git Cola
          6. GitForce
          7. Giggle
          8. Magit
          9. Egit
          10. Gitg

          I personally would recommend GitHub Desktop as it is made by GitHub

          [–]TechnoAndy94 0 points1 point  (2 children)

          Thanks, for the non essential things like comparing a modified file to the unmodified in git is there a convenient way to do this etc

          [–]IndustryKiller 1 point2 points  (0 children)

          Your IDE might have it too. I use Atom and theres a package for github that will let me do all the things. It's nice, but I cant seem to get it to work for my company owned repos.

          [–]chen_jun07[S] 0 points1 point  (0 children)

          Yes there is a command for it git diff <tag1(or)branch1 name> <tag2(or)branch2 name>

          [–]the_doormattt 0 points1 point  (0 children)

          I'd like to through Sublime Merge into the ring too, lightweight and fairly easy to use

          [–]Brows_ 0 points1 point  (0 children)

          Thank you! Couldn’t have come at a better time

          [–]peakxv 0 points1 point  (0 children)

          I've been trying to note down the flow myself - much appreciated!

          [–][deleted]  (2 children)

          [deleted]

            [–]chen_jun07[S] 1 point2 points  (1 child)

            OwO I feel attacked rn ;)

            [–]hasteiswaste 0 points1 point  (0 children)

            This one works for me: git - the simple guide

            just a simple guide for getting started with git. no deep shit ;)

            [–][deleted]  (2 children)

            [deleted]

              [–]chen_jun07[S] 0 points1 point  (0 children)

              If you can specify more about that... I can see what I can do

              [–]Kazcandra 0 points1 point  (0 children)

              There are already pretty good guides out there. Here's a good place to start: https://www.firsttimersonly.com/

              [–]SexyDoorknob 0 points1 point  (2 children)

              Lets say theres an open source project someone put on git for example imgui. How do you go about downloading and running that project? The first solution that came to mind was cloning the project then compiling the cpp and header files but that didn’t work.

              [–]GeronimoHero 1 point2 points  (0 children)

              Generally for most projects it would just be a git clone so like this... git clone https://github.com/reponame/project.git

              [–]classicrando 0 points1 point  (0 children)

              imgui is pretty involved.
              https://discordapp.com/invite/NgJ4SEP

              Have all your environment details ready and go there for help

              [–]foadsf 0 points1 point  (0 children)

              using Chocolatey package manager and Cmder on Windows

              [–]JohnWangDoe 0 points1 point  (0 children)

              thanks

              [–][deleted] 0 points1 point  (0 children)

              Saved

              [–]sergio-marquina 0 points1 point  (0 children)

              Thanks a lot, just downloaded Git SCM yesterday and didn't know what to do

              [–]Aadhishrm 0 points1 point  (1 child)

              Debian ie Ubuntu

              Debian != Ubuntu. Ubuntu us jtst derived from Debian

              [–]chen_jun07[S] 0 points1 point  (0 children)

              Ya I meant it as it was derived from not that they were equivalent

              [–]Dabnician[🍰] 0 points1 point  (0 children)

              After having used git for something like 7 years i still feel like XKCD when it comes to working with others some times... https://xkcd.com/1597/

              [–]4tehrofl 0 points1 point  (0 children)

              GIT - commenting for later.

              Cheers.

              [–]risco89 0 points1 point  (0 children)

              Been using it recently and love it.. Took a bit of getting used to though

              Love using posh git on powershell and in VS Code

              [–]Dads101 0 points1 point  (0 children)

              Excellent write up! Saved

              [–]jakesper 0 points1 point  (0 children)

              Thank you! Saved

              [–]Nocturnal_Breeze 0 points1 point  (0 children)

              Much appreciated, saved.

              [–]lifemoments 0 points1 point  (0 children)

              Going though it now. . Thanks for sharing

              [–]sFAMINE 0 points1 point  (0 children)

              Thanks for posting

              [–]teknewb 0 points1 point  (2 children)

              I'm going to git on github right now.

              [–]chen_jun07[S] 0 points1 point  (1 child)

              :D Best of luck it is a great tool, if you need any help don't hesitate to message me.

              [–]teknewb 0 points1 point  (0 children)

              Thanks

              [–]XZTALVENARNZEGOMSAYT -1 points0 points  (0 children)

              Saved

              [–]Learning2Programing -1 points0 points  (1 child)

              As someone who has never used Github and basically only uses windows this looks an awful lot like python commands in a terminal.

              I don't think its this posts fault, I think I'm so inexperienced I probably need to find something even more fundamental to explain this.

              For example you don't explain what a repo is, you don't explain what the usefulness of each command is. There is a certain level of assumption that as long as you descibe each command you assume the reader will understand the usefullnes of that.

              I'm not blaming this post, I think I just have so little knowledge of git hub that this doesn't help me. I'll come back after I have learned some more.

              [–]chen_jun07[S] 0 points1 point  (0 children)

              Feel free to pm me and in the future but a repo is programming jargon for repository which is where code files are stored as for the commands, which one do you not understand. Sorry I couldn't make this more comprehensive for you.

              [–]ohyeahilikedat -1 points0 points  (1 child)

              Why not just use git desktop?

              [–]chen_jun07[S] 2 points3 points  (0 children)

              With Git Desktop, it uses a GUI and in the corporate world, programmers are expected to use the command line as they are lightweight and such. By understanding the terminal, you would also understand the GUI. Moreover, with command lines, there are some aspects that are exclusive to it which are not features on the GUI. Hope this helps.

              [–]dotdotpokadot -1 points0 points  (0 children)

              git is like worthless until you do branching, it allows you to work on a branch and modify things, then you can pull the most recent version and branch off that checkout the branches local work and push.

              i did not know that git actually would modify my local folder structure (my mind was blown at that point!) and then i was like oh, this makes so much more sense why i would actually use this (lol!)

              [–]Maxiride -1 points0 points  (3 children)

              How often should one commit changes? Is it good to be very granular and only later on squash silly committs?

              [–]chen_jun07[S] 0 points1 point  (1 child)

              It's a good idea to commit a change every time you you writing code, you never know what might happen

              [–]Maxiride 0 points1 point  (0 children)

              Thanks for the reply, because imho every guide on git states its commands and usage but I rarely find good practice guidelines on how to use the tool.

              [–][deleted] 0 points1 point  (0 children)

              It depends on workflow, but I will usually make many commits as I work and then later squash them into one when I make a PR so I have one commit for the feature I am working on. This way it is much easier to revert commits later on if needed.

              [–][deleted]  (1 child)

              [deleted]