Thinking about starting to use GitHub, convince me why or why not!

git

#5

I hate how my code is reproducible, and how I can roll back my bad decisions and test new features without jeopardising my code base. I miss the risk.


#6

There is literally no better guide out there.

I started putting things up on GitHub simply for record-keeping. Where I found it to be absolutely indispensable was in building my first Shiny app - I would get one thing working, but want to test something else out without ruining what I knew already worked - which is unbelievably easy when using GitHub.


#7

Has anybody got any experience with GitLab? Does it work the same way as GitHub?

The reason I ask is that my company has a GitLab server which appears to only have very limited use and has no support.

I have no experience with GitHub so would need to rely on resources like Happy Git and GitHub for the useR if the experiences were similar enough.


#8

As far as I’m aware, GitHub and GitLab are very similar.

They both offer hosting of git repositories, either online/in the cloud or on premise (sounds like you have an on-premise GitLab server).

Either way, I’d say that using git (the technology) and GitHub/GitLab are excellent for a number of reasons, most of which @jennybryan and colleagues have able covered.

We use git regularly at work for helping us keep track of projects and how they evolve over time. It’s especially useful for some of the projects we do in highly regulated areas (e.g. financial services) where it’s critical that we can reproduce answers from a given point in the project - git makes it very easy for us to do that.

Something like GitHub is also really helpful personally for me to have a place to put my testing/playground code and collaborate with old colleagues & friends on some little pet projects.


#9

Thanks @jim89. I’ll have to check whether that works.

Almost all of my R work is solo, so the sharing thing doesn’t come into it, but I would love to evolve my work into the quality I see from others on their public github repos.


#10

What does everyone think about GUIs for GitHub such as GitKracken and other like that? Do they help learning git or is command line better to go?


#11

GUIs (including RStudio’s git pane) can lower the bar to entry a bit, and make it easier to make a quick commit and see the commit graph. When things get hairy, though, the CLI is usually simpler to figure out (and get solutions for). It has really well-assembled messages and errors, so it’s less opaque than most command line programs.

The nice thing about git is that it doesn’t care how you interact. Clone through the Github GUI, commit through RStudio, amend the commit through the CLI, and then push through RStudio again, and everything works fine. It’s a little magic, if you think about it.


#12

I really like the GitHub desktop app for branching and making commits especially for contributing to other people’s open source projects. Having it be visually represented so well really helps me be confident I am not accidentally committing a file I shouldn’t or overwriting some code unexpectedly.

It’s lacking in capabilities for more complex git needs but as @alistaire mentioned, it’s easy to switch back and forth to command line depending on what you need to get done!

If you want an interactive quick intro to git/github I really like: https://try.github.io/


#13

You might also find this piece helpful:

Excuse me, do you have a moment to talk about version control?
Jennifer Bryan

It’s an expanded version of the “Why Git? Why GitHub?” intro of http://happygitwithr.com.

http://happygitwithr.com is mostly about installation and early workflows. The article above is a general explainer and motivator. There is some pain involved in starting to use Git, so it’s important to know why you’re putting yourself through this.

I would never advocate adopting Git w/o also using GitHub or GitLab. The remote, web-by, potentially collaborative aspect is a huge part of the value proposition. Being able to click around your files, at various commits, is incredibly helpful and no local Git workflow approximates that very well IMO.

I’m also a big believer in a graphical Git client. I use SourceTree but I think GitKraken also looks very good. It didn’t exist when I started this journey and I don’t feel like switching. I also use RStudio a lot for basic stuff. Anecdotally, I think new Git users tend to make more mistakes when they only use command line Git. It’s just harder to see the state of the world. I think graphical clients are really useful when you’re still trying to digest the concepts of Git.


#14

You should use git even if you don’t host remotely on GitHub or Gitlab. On Unix based systems (Linux and macOS), a simple git init will turn any folder into a version controlled folder using git.

You mentioned privacy reasons for not using GitHub at work. Just for reference, many companies, including mine, host all their code on GitHub. Private organizations and repositories just cost money.


#15

@jennybryan Thanks for that article, it is really interesting and a big help! Right now I’m leaning towards using GitKracken to learn through.

@raybuhr I know that there is privacy options for GitHub, my organization just won’t pay for it so I was just making the distinction that I would be using it for personal projects, rather than learning it through work.


#16

My lab mate recommended bitbucket because it has free “private repos”, you can have a look.

By the way if you stay in academic GITHUB will hand out “private repo” plans.


#17

FWIW, I just ran my first workshop, building a website with GitHub Pages. The idea was to give ppl some exposure to the basics of git without the extra cognitive load of also having to learn the command line (which some students hadn’t used).

It went pretty well! We hit a few unexpected snags, but for our basic purposes (forking, cloning, committing and pushing) it was great. I would tell participants to go learn the command line (say, with Software Carpentry) if they wanted to start using git more, but I think it did what I wanted it to :smile:

Also, I pinched a couple of figures (with appreciate citations, of course :wink: ) from @jennybryan’s excellent paper above.

EDIT: one thing I didn’t anticipate beforehand was that some students were running Linux on their laptops. I sent them toward GitKraken, although frankly if you’ve installed Linux on a laptop your probably comfortable with the command line.


#18

Okay, I signed up for a GitHub account. Time to figure out how it works now!


#19

I found that piece really helpful and I wish I’d read it when I first started using GitHub instead of cobbling together my GitHub knowledge from several less helpful and less complete sources. Thank you!

Also, I think graphical Git clients are really helpful even if you are comfortable with the command line. The value isn’t so much in the buttons that replace the various command line functions as it is in seeing the history of the project. I’d started with command line, but after trying GitKraken found that having that the visualization of what was actually happening was extremely helpful to actually understanding what was going on (as opposed to just sort of using git without destroying anything, which was what I was basically doing from the command line).


#20

I really agree with @natekratzer re: value of graphical Git client. This seems like an area where people are easily convinced they need to use command line Git for nerd cred. But this is purely a workflow matter! No one else ever needs to know, unless you share here, how you work with Git. All that matters is that you accomplish your goals. I like to switch between SourceTree, RStudio, and command line, depending on the task at hand.


#21

I absolutely agree—although if you do find yourself in a situation where you have to use a command line (like on a remote machine), setting an alias like this is a great fallback (though obviously not for beginners):

[alias]
    plog = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative

Doesn’t hold a candle to reviewing on a graphical client, though.


#22

Yeah, true, and you also eventually need to learn enough command line git to understand, e.g., Stack Overflow Q&A and blog posts. There’s no substitute for building an understanding of the concepts. But then you can still pick your preferred method to enact what you learn.


#23

Inspired by this conversation, I just configured my local machine and R Studio to use Git/GitHub. I used http://happygitwithr.com/ to guide my setup, and I can happily report that it was much less painful than I thought it would be (@jennybryan :100::100::100:). Once I set it up, I created my first repo for a class project I am working on. I haven’t got much up there yet, but how cool is it that GitHub will automatically render a geojson and toss it on a basemap?!

@dlsweet, how’s your Git journey going?


#24

@mfherman Great job! It looks like you’re moving right along! :+1:

As for me, I have been skimming http://happygitwithr.com/ and just jumping right in. I just finished putting up my first actual repo which holds an ELO-based prediction model for the NHL! Now, I just need to get it organized with a nice README and integrate using version control into my normal workflow!