First Steps in Learning the Use of Git & GitHub in RStudio
videoimage: thumbnail.jpg
Transcript#
This transcript was generated automatically and may contain errors.
Welcome back to the RStudio Enterprise Community Meetup. Hope everyone's having a great start to the week. Very excited for our First Steps in Learning the Use of Git & GitHub Meetup today. If you've just joined now, feel free to say hi through the chat window, maybe where you're calling in from. It's always fun to see people calling in from all over the world or listening in from all over the world.
A special welcome to you if this is your first time joining us today. This is a friendly and open meetup environment for teams and people from the community to share use cases, teach lessons learned, just meet each other and ask questions in the chat as well. And these meetups happen every Tuesday or most Tuesdays at 12 Eastern Time.
But together we're all dedicated to making this space inclusive and an open environment for everybody, no matter your experience or industry or background. During the event, you can ask questions wherever you are. So if you're watching on LinkedIn, you can ask there. If you're on YouTube, ask there. As well as anonymous questions through Slido.
So one thing that I'll ask everybody now is if you're joining us today, do you use version control? For example, get at work today. And I'll try launching the poll to see if people want to answer over there.
But thank you again so much for joining us. I would love to introduce today's speaker, Muna Belaid. And Muna is currently a business intelligence consultant at Prime Analytics. She is active in various tech communities where she co-founded PyLadies, Tunis, and Tunis R User Groups. She is also a member of R-Ladies Global, Arab R Committees, and lead of R-Ladies Paris community. So with all that, you may have seen a lot of awesome events with Muna before on LinkedIn too.
Thank you. Hi. Hello. Thank you so much. Thank you all for joining us. Yeah, it's my pleasure. Thank you for the nice introduction.
Session overview and requirements
So thank you all again for joining me today and joining us. So today, to people who use of Git and GitHub in RStudio. So as Rachel introduced me just briefly, so I'm a Business Integers Consultant at Prime Analytics, and I'm also the Community Organizer at R-Ladies Paris. This is where you can find me like on Twitter or on LinkedIn.
What about the session outline? So I'll start by giving an overview of version control, what are the benefits of version control. Also share with you some popular version control systems. We'll see what's Git, what's GitHub, and then we'll move to some practical parts. And this is where we get familiar with the use of Git and GitHub.
So what about the requirements for today's session? You should have RStudio installed. Also, you need to have a GitHub account and have Git also installed on your local machine.
What is version control?
Yeah, first, what's version control? So version control, also known as source control, is the practice of trailing changes to the code for a project, application, or even each software component, is typically organized in a folder structure. So version control will help you track every individual change we make on the available files in the code, so by each contributor in your teams. And this step will help you to prevent concurrent work from, I would say, conflicting.
So what are the benefits of version control? Yeah, so it will help you streamline your work instead maybe of spending your time inspecting and like reading over whether this version is like of an Excel file, for example, is this the final version or it could be any other file. So version control will help you to be confident about your analysis, about your work, and like you can move to the next step. It will enable you to make your work more reproducible if you are like research.
And in this context, I want to tell you about an illustrated series that has been recently created by Alison Hurst and Julia Stewart-Launce. So the figure that you are looking at and which I found so insightful is one of the amazing illustrations that tell a story, a good story, about why GitHub is so powerful for supporting, using, contributing, and failing safely.
So the figure that you are looking at and which I found so insightful is one of the amazing illustrations that tell a story, a good story, about why GitHub is so powerful for supporting, using, contributing, and failing safely.
What are the popular version control systems that you have today? So it could be like you have Git for sure, but also there are many other choices. So like SVS, but here we are going to focus on just one, Git.
Git and GitHub explained
Yeah, what's Git? So this is an open source software and is a distributed version control like software. What's its function? It will, as I said, so it will help you to manage evolution of a set of files that you have and what you call a repository, okay? Being distributed means that every developer working with a Git repo so has a copy of that entire repository. I mean every comment, every branch, every file. So it was initially developed in 2005 so by Linus Torvalds and so he's who's the one mainly of the Linux operating system.
Yeah, then what's GitHub? So GitHub is a collaboration platform and it's the most popular hosting service for collaborating on code using Git. So other hosting services may include Bitbucket and GitLab, okay?
So come back to this series. Another second illustration for the GitHub illustration series that I have talked about to you in a moment ago and what's the definition of collaboration? So by Jenny Bryan. So collaboration is the most compelling reason to manage a project with Git and GitHub. So my definition of collaboration includes like hands-on participation by multiple people like in a team including your past and future self and I really like this definition.
Collaboration is the most compelling reason to manage a project with Git and GitHub. So my definition of collaboration includes like hands-on participation by multiple people like in a team including your past and future self.
Checking Git installation and setup
So first of all, you need to check that Git is installed. To do so, we use the terminal of RStudio. So from the terminal, so RStudio like provides access to the shell from its environment, from RStudio. So to do so, I will move to RStudio and let's see what we get by entering the flowing command which you get.
Okay, so I hope that you are like you have my screen where I show you RStudio. Perfect. So on my side, I will just type which Git. So I will check if I have Git installed. So it's okay, I know that I have Git installed. So normally for me on my side, I should get this path. So this one should be the path of my Git executable. On your side, for people maybe who didn't install Git, you should maybe get an error like a command not found.
Also, maybe the terminal which should be next to the console here tab. If this one is not visible, what you can do is like go to tools. Okay, click once, doesn't work, it's okay. So normally you should go to tools, then you should see terminal and another option after terminal, sorry, to get it visible.
Okay, yeah, what about the version that I have, the Git version that I have today on my local machine? Just to check this, I will write Git double dash version. So for each command, for each Git command, it's okay that we have Git at the start. Okay, so on my side, I have this Git version on my Windows machine.
Communicating with GitHub using HTTPS and personal access tokens
Yeah, what about communicating with GitHub? Yeah, so when you want to interact with a remote Git server, such as GitHub, you need to include some credentials in our request, which proves that you are a GitHub user that is allowed to do some operations on GitHub. So Git can communicate with GitHub based on two protocols, HTTPS or SSH. And the two protocols like use different credentials. So for our case, we will use this one, HTTPS, and to do so, you need to create a personal access token.
So in the past, it was possible to use the password, okay, that is associated with your GitHub account. But nowadays, it's like, it's no longer possible. It could be possible with other hosting services, but for GitHub, you should generate this token.
Okay, and to do so, so you need to go to this directory. So this is GitHub. I will come back later in the practical parts to explain more about GitHub. But let's now focus on this page, okay. So this is where we generate the personal access token. So whenever you are like doing, like you are doing a Git, you are executing a Git command, and you are asking to provide your token, you should do, okay. So these are, for example, the tokens that I have generated.
Because each token has an expiration date, it's okay if you receive an email associated, that is associated, I mean, an email address that's associated with your account to generate a new one. So for example, for me, if I want to generate a new token, I'll click on this button, okay. So we click on this one, the classic.
So I think I will do this. It's here. Fine. I can confirm my access. So you should give a name to your new personal access token. On my side, I will just give it a name as PAT, personal access token. Also, you should define the scopes. What does it mean? That means the rights that you want to give to this token. So generally what is, and what is recommended to select, is this one, the repo, then how to create Git, and the workflow.
So I will not, I won't click on this button, because already I have one, but on your side, you can click on generate token, this button, and you should get the token. That should not be visible to anyone, and you should save it, save it maybe in a file, a secure file. But what is also provided by RStudio is like, you can use the library, use this in RStudio.
And you can do the following in RStudio by typing these two commands using the use this library. So these two commands will help you to store your PAT. So whenever you are asking, ask it to provide it, it's possible to provide it.
Okay. So I will just make a copy of this code and come back to my window where I have RStudio, and always in the terminal, maybe I will have, okay, I will paste it here. So what about the first command, create GitHub? I will just run, control enter. Yeah, this is what I get. So to, okay, it will, so you can also create a new token using this command, but let's say that it's okay, I have my token, but I want to be able to get access to it. So I will come back to RStudio and using the second command, control enter.
Yeah. So this is what I get as option. So one, two, three. So let me see. Yeah. So it will ask you if you want to keep this credential. Yes, I want to keep my token. I won't change it. If you want to replace them, or if you want to see the password or token. So if I click three, it will, it's okay. I will, the token will be visible to me. So this time I'm not, I'm not like obliged to, to save it in a secure file. So I will have the token here.
So after, after setting up the communication between Git and GitHub, you need to introduce ourselves to Git. So who are you as user? Let's go to the next step. Yeah. So in RStudio, you need to type each, each line, like each command line separately. So you need to define your username and this one must be the same as associated with your GitHub account. The second, and for the username, it's okay. It has not been to be the, your, your username on GitHub. You can like choose anyone else.
So if you want to check that, so that it's okay. Git knows you. You come back to our, come back to RStudio and in the terminal, let me go back to the terminal. I'll just write git config, then double dash list.
Yeah. So normally your username and your, your image should be displayed.
Q&A: accounts, cloud, and version control
Yeah. So I think you have some questions in the chat. If you can like have some questions, it's fine for me.
So I just checked over to Slido and I don't see any questions yet. So I just want to remind people that if you do want to ask any questions, you can ask them either on LinkedIn if you're watching there or on YouTube but you can also use the Slido link here on the screen to ask anonymous questions too. And I was trying to do a live poll to see and looks like we have 50% of people so far who answered that use version control, 17% no and 33% learning to use it right now.
Okay, perfect. So first of all, you need to check that Git is installed. To do so, we use the terminal of RStudio.
Yeah, sure. So what I would recommend is like, because it's possible to as a team, it's possible to work on the same GitHub repository from different accounts. Like each one in the team has its own GitHub account and like you are collaborating in the same account. So it's okay. Each one should have its GitHub account. It's like safer. Yeah. I would say.
And then I think another question was earlier, can we push our work from our cloud to GitHub? Yeah, this is new in RStudio. So I didn't try it, but I have seen the Git pane in RStudio cloud. So it should work. Yes.
Getting the most out of GitHub
So now let's now go to the next part, getting the most out of GitHub. And so we learn to do two things. First of all, how to create a new RStudio project. Okay. And push it to GitHub. So during this part, we learn how to create a GitHub repo and how to link it to your project on your own machine. The second part is about cloning an existing GitHub repository to an RStudio project. And during this part, we learn about how to connect a new RStudio project started from scratch to GitHub.
So you need to understand the process, the terminology. Let's say you want to contribute to a repository of an open source project on GitHub. Okay. So here you are able to see the remote repository on GitHub. Then you will use git clone to, first you will fork it. Sorry. That means that you will make a copy of this repo so that you make changes to a project without affecting the original one, the original repository. So it's okay. You have the copy. Then you will use git clone. Okay. The command to make a copy. That means that you are making a copy of this repository on your local machine.
Then you can work locally on this project by making changes on the available files. Then you need to add the updated files on which you made a change to what you call the staging area. And this is by using git add. However, git doesn't really affect the repository in any significant way. Why? Because changes are not actually recorded until you run git commit. And last step, you need to push these changes to the remote GitHub repo. So to make your updated files available to your collaborators. Okay. People who are working with you in the same team.
Last thing also, if other people are like working on the same project, on the same repository, I mean, or maybe also you are working on a different computer, you can pull, you should like pull back, pull any changes back first to your local repository. So like everything is synchronized. Okay. You see the point?
Yeah. So this is an overview of the git commands along with their explanations that you should know as a beginner. So I have already covered a part of them that should be, but that should be also helpful for people who will have a look at the slides later.
Practical part 1: creating an RStudio project and pushing to GitHub
Yeah. Yeah. Sure. So let's say that you have a directory on RStudio. If you want like to create an empty git repository to have this new directory under version control, you will, for example, you will execute like git init and you will put the link of this directory. So this directory will be like under version control. So every changes on the file that you have in this directory will be tracked. It will be like you can commit them and you can work after this, you can work with the git commands. Git clone, that means that you will make a copy of this repository and this repository, which is normally on GitHub, should be like on your local machine. Okay. And git config, this is how you introduce ourselves to git because like if git wants to communicate with a remote git server such as GitHub, you need to introduce ourselves. That means that you need to introduce yourself by username and also you need, you have another command about git config user email. You should put the email associated with our GitHub account.
So first of all, you need to, as a first user, as a new user, you need to generate a token. So this token should be generated from GitHub. So from GitHub, you have a page settings here and you should generate this one because sometimes when you are working with git, it could be that you will ask you about yourself. Who are you? So you should be allowed to do some operations between git and GitHub. So when git will ask you about this, you should provide this personal access token.
So either we'll go over these steps manually like here. Okay. And you will click or generate token. But also as RStudio here is like wonderful and it provides as like with the basic git client through the git pane that you have here on the right side. Also you have this use this library, which normally is useful for automating some repetitive tasks and also is useful for here to generate this token. So using this command, if I click once, I will be redirected to GitHub and like generate a new token. And this command will allow you to save this token. So whenever you need this token, you don't have to like to save it in secure file on your computer. Maybe if you run this command once, you will get access to this token here. Okay. And then you should provide this to git when it asks you about it.
So first of all, you need to, as a first user, as a new user, you need to generate a token. So this token should be generated from GitHub. So from GitHub, you have a page settings here and you should generate this one. And if you want to communicate with GitHub, just you have the steps here. You can follow and you can reach out to me later. Either we'll go through these steps or also from RStudio, just you need to make a copy of these two commands.
Okay. Thank you so much. This is an important. Yes. You're welcome. Then you need to tell GitHub who you are, like you define your username and your email. And then just, you didn't go through these steps. Okay. From this part, I'm just explaining, I was just explaining the terminal about like using Git and GitHub. And now I will like go through this first practical type. It's about, we learn about how to create an RStudio project and to push it to GitHub.
Okay. That means that you will learn how to set up this local repository, like you will create a new RStudio project now, and then we'll link it to a remote GitHub repository. Okay. We'll go through this together. So I have the steps here, but also I would like to go this live now. Okay. So let me go to RStudio and create a new RStudio project.
Okay. So to create a new RStudio project, we'll click on this button to create a project. You should get this window. So just click on new directory. Then we'll click on new project as you want to create new one. Then you should give a name to the directory. So let me first maybe change the directory. So I will browse my files and I'll choose this one. I will give it a name like repo1 because we have later another repository repo2. So this is a local repository. This is a local directory. Make sure to keep this one selected. Okay. Because as you want to create a Git repository, remember later when I told you about the use of the command git init, it's like you are creating a directory under version control. So here at RStudio, you don't need to write this command. You just need to keep this one selected. It's like git init if you want to write it in the terminal. Okay. You see the terminology. So just you create opening new session. Okay. I'll create a project.
So I'm just creating a new one. So what's the object of this part? Let's say you started a project. Okay. And then you want to collaborate on this project with other team members. So to do so, we think about the... So it's useful to use Git and GitHub. So that's why you will have also a copy of this repository on GitHub. Okay. So later I will create a repository on GitHub and connect the local repository to the remote repository. So everything, every change that you make of the local repository, like you can push it and also you can pull back the changes that maybe would be made by your team members from GitHub to your local repository.
So what you have here, just you have two files that should be listed here on the bottom right here. And also if you would have a look at the Git pane, you should see these two files. So before moving to GitHub and creating the repository, you should have these files under version control. What does it mean? This file should be tracked later. So first of all, instead of using the command line Git add, here from this Git pane, from RStudio, you just need to tick the boxes that you have under the stage column like this.
So you are like adding these two files to what you call a staging area. Go ahead. Yeah. After doing so, you need to click on commit. That means you need to save this operation, to save these files. Okay. So we click on commit. You should get another window. This is the review challenge window.
Normally, you should get all the, because for now, this is a directory started from scratch. We don't really have any changes to be tracked. Okay. But normally, you should see the changes here with an output like for changes should be in red and for things that you kept should be in green and this is what you should get. Okay. Then you need to leave a commit message. So why this is useful? Because for someone else, these commit messages should be later displayed on the GitHub repository that is connected to this local repository. So someone else, when we see this file with these commit messages, he will be able to understand what's the objectives of these commit steps. Okay. So what is recommended is like you use a verb, then you describe like you start your commit message with a verb. So for example, let's say, create new directory.
After doing so, you need to save. You need to click on the commit button like this. So you have some information. There are things, so don't focus on all the information, but the main things is that you are saving the two files. Okay. Then you need to close this window and also close this one. And what you can see in this Git pane, that everything is is straight like this proves that because the two files disappeared and which proves that this is a successful commit.
Okay. Now I will move to GitHub, sorry, and I will create a new repository. So what does it mean to create a new repository? So first, this is GitHub. Let's go to the homepage here. To create a new repository, you should have the green button here to start a new one. You click on this one once.
Yes. So you should provide some information. So for example, for me, because I'm managing some organization on GitHub, so I should select my name. So my profile, who's the one who will create this repository? It's not like none of the organizations that I manage. So I will choose this one. On your side, if you don't have any organization, your name should be automatically displayed. You should provide a repository name. So this is important information that repositories should be displayed short, and you should not have white spaces in the names. Okay. Either you use underscores or just don't leave any spaces between your name, the name that you will give to a new repository on GitHub.
So according to our practical part, the repository name here should be the same one as the same one as our directory in RStudio. So on our side, the name is repo1. So this one should be the same. So what you are trying to do here is that you are trying to have this RStudio directory and visual control. Okay. Let me go back to GitHub and I'll just type repo1. Also, you can put a description, but it's okay. I will move to the next part because this is just a repository for tests. You can choose if you want to have this repository public or private. Also, it's important also to choose a license if you want to share your work. It's important to do so, but for now I will move and I will click on this button. Okay. Create repository.
So what you should get here? On this quick setup page, you should get many codes that are useful for various situations. On our side, what you want to do is that you want to push an existing repository from the command line. That means you will use this. You need just to make a copy of these command lines. If I want to, maybe let's break down these command lines. So what does it mean? That means so for every Git command, it's okay. We'll have Git at the beginning. Then a remote add. This is how you want to configure another repository that should contain the same content, the same information, the same files that you have on our local machine, on our record directory. Okay. So that's why we have remote add here. Then origin. This is the nickname that you will... So instead of using each time the following address, web address, we'll use this nickname origin to refer to this web address.
Okay. I will make a copy of this code. I will go back to RStudio and the terminal where I can execute the Git command. Yeah, I click once, right?
So I will make a copy of this. Ah, because it should be... Yeah, it should not be Ctrl V for Windows machine. It would be Shift Insert to make a copy, to make a paste operation. Yeah, this is the first command. Then I will make a copy for the second one. So it should be Shift plus Insert to paste, Enter. And then using this command, Git push-origin main. So instead of using this long web address, we'll use origin here. That means every change later that you will be making on our RStudio directory, if you push it, it's possible to push these exchanges to this, to make it available, to make it available to the collaborators that you have on your team. Maybe you are working on the same project. I hope that I'm clear enough. Otherwise, don't hesitate to ask your question in the chat.
Yeah, fine. If I go back, like, refresh my page, and let's have a look now at this RIP1 repository. Yeah, as you can see, now this repository is not empty because I have two files here that I have on this RStudio directory. What is also recommended when you work with a repository in GitHub is like you have a readme file. Okay. So you have this file, like you will have a description of your repository. So someone else, when they will look at your repository, he knows about the project, the process. Maybe you want to include some code in this readme file. So let's have a readme file here. So we'll click on this button.
And then, so for information, this readme file is in markdown format. So this one, MD, is short for markdown format. So I'll just write here, this is a test repository. I'll just make it simple. Welcome to the session. You need then to save. You can also add another, like, an optional description if you want, but you can, like, save by clicking on commit new file.
Okay. So the file now is available on GitHub, but what about the Git, sorry, what about RStudio? Did you have the file here? No, for sure. Why? Because you need to pull the changes back to our local machine, to our local directory. And how we do this, we need to click on this button about pull. We'll pull these changes back. Okay. Just click once.
And you can see, you have this information, one file. And if you have a look here, that you have the readme file here. And for sure, if you want to add, like, a new script here, you need to push these changes to GitHub. Okay. I hope that it was clear for you.
Q&A: forking, cloning, and pull requests
Yeah, I was thinking, one question over from Slido that might be useful to cover right now. Somebody asked, when making a copy with a fork and then working on the files and pushing the changes, does the original project, is the original project affected by that?
No, no. When you make, when you make, you take a copy from the project, no. So because later, when you would pull your changes back to this repository, it will be through a pull request. So someone who, the one who is managing the project, the one who is managing the project, the one who is managing the repository on GitHub has a choice to approve your changes or not. So, no, when you make a copy, it's okay. You will not, it's like, it's not your original, your original, the original repository, but it's like your own original repository. Like, you can do what you want, but the other person either will approve your changes or not.
I hope that was clear. Thank you. Yeah, that's something that was always confusing to me, and just like, I'm just getting started as well, but knowing the difference between like cloning a repository or forking a repository and like, if it notifies people as well, like if you're just trying to learn from someone's example.
Yeah, it's okay. Like, if you have a repository and you fork it, that means that will be available to you on your GitHub account. If you, if then you will clone it, that means that you will have this repository on your local machine, from your GitHub account to a local machine. After this, if you want to make some changes, we'll put, we'll put these changes, we'll pull, sorry, these changes back to your GitHub repository, and being on your GitHub repository, this time we'll like create a pull request, and like request if you, if you, if the one who is managing the repository wants to accept them or not, the change that you make.
So to just double check, so if for anybody who's just getting started, if you aren't trying to make a pull request, but you just want to use somebody's example and adapt it, would you then just clone? Yeah, you can do it. You can, because the, you, you have access also to what you call branches, so like you have the main branches, branch, then you have the other branches that could be like created by other people, other contributors, and you can have access to them.
Practical part 2: cloning a GitHub repository to RStudio
Yeah, so let me go, thank you all for your attention. Let me move to the second part, and generally this is the approach that is, that is like followed, okay.
Yeah, I will go back here. So the second approach that you might follow is that when you, you use, is that you set up a remote GitHub repository first, okay, and then you try to connect another studio to this GitHub repository. So you have some steps here, but what I will do, so I will go first to, so for me, I don't have any, so normally it should, yeah, so let's say you have a repository on GitHub, okay. Already you have this one on GitHub. You should, this time, this is what you call, we'll clone this repository. So to do so, to clone this repository, we'll go to, normally you should have this one, this green button, code, and you clone it. So either we'll make a copy of this, of this code, so already you have this button here, and then you come back to RStudio.
I will make sure to close this. I am not seeing, I'm not seeing close project. It's fine. So let me have a new RStudio project. You click on this button again, but this time we'll not click on new directory because already you are citing a project from like a version control, like repository, okay, from GitHub. So click on this one, and this time, so either we'll work with Git or subversion, so we'll clone a project from this Git repository that you have online, and then you provide this link, okay, and don't try to change, to change the name, okay, because this one should be the same. The name of the repository on your local machine should be the same online, and then open new session, or it's okay. I can have the other one because, yeah, it's okay. It's good that you get this error. This way you can learn something new. Yeah, destination path already, because already this directory is under version control, so it's not possible. So what I will do is that I will, I will very quickly create a new repository.
So when you get this error, that means that already you try to connect a local repository to a GitHub repository, and this one is already under version control. So I will try to create a new one, repo, and I select this one, and this time I can start like having a readme file at the beginning, and I don't need, I don't need the license. I'm not working on a project, important.
So for this repository I have only readme file. I will make a copy, that means I will clone this repository, this is the right word, come back to, so I need to close this one, already exists, already exists, yeah. I will create a new project on RStudio, then git, then you put this name, and don't change this one, yeah, should be in the same folder, then create project. As you can see, cloning into this repository, and if I want to, let's create a new R script, okay.
So, if you get our repository, you don't have this R script, that's why you need first to add this file to the staging area, I will get back to my git pane here, I will get back to my git pane here, and then you need to click once on each box under the staged column. Otherwise, you can use the terminal and write git add white space point, and all these files should be, should be like staged.
So, what I would like to do is like git add, and then, this one should work, so you need to comment, you should get the review changes window where you will put a comment description. So, you should get this window again, yeah, it's okay, every file is, as I told you, you should get every change like in the green color, okay, of update, the repo, and then you click on this button, comment. Yeah, I have three files changed, you can close. Now, if I get back, I won't see my file, okay, even if I refresh, because I need to push this, this file, okay.
Okay, now, if I come back, I believe I will see my script, yeah, I can see my welcome R file here.
The Git & GitHub cheat sheet
So, here, maybe it's time to, to tell you about the git github cheat sheet that I have created, and I will tell you about, like, quickly about the process that I have worked through to, to submit this new cheat sheet to the cheat sheets github repository with like pull request. So, this is the cheat sheet github repository that, that contains the source files of the current archived and every, like, translated version of the cheat sheet. So, Rachel will kindly share with you the link in a bit. So, you have, like, some folders, the pngs format of these, of these cheat sheets, the keynotes and powerpoints folders.
So, for example, as I told you, the pngs folder will contain the image format. So, first, I, I forked the repository, okay, as I told you in a moment ago. Then I, I cloned the cheat sheets github repository. Then, as, as I showed you, I will click on the, I clicked on the green, so the button clone or download button and, like, I made a copy of the, I made a copy of the link. After this, after, like, creating the cheat sheets and, like, converting it to pdf format and to powerpoint format, I put the pdf version of these cheat sheets in the pdf first and I also did the same for the powerpoint version and I included the, the image of the first page. Yeah, I did the commit, commit, sorry, and then I created a pull request. Okay, these are the steps that I was talking about a moment ago. And, and then here, I, like, provide some information about this one in, like, you should have this section below. So, I highly encourage you to, to, to go through these initiatives, like, maybe you, you have, like, some interesting topic, you, you feel like she, well, she, she is missing, so don't hesitate to, to go over this.
Resources for further learning
So, I, I will highly recommend a book which was written by Jenny Brines. So, this one, Happy Git and GitHub for the User. This is so useful. Also, there is very useful, full, like, open source documentation provided by GitHub and there is also an interesting free course provided by GitHub, Introduction to GitHub. Thank you all for attention. I would be happy to answer any other questions and this is where you can find me. Thank you.
Q&A: Git ignore, project structure, and best practices
Awesome. Thank you so much, Muna. I, I just shared some of those links into the chat there and your cheat sheet as well. It's really helpful to see an example of how you use this in practice with contributing to the RStudio cheat sheet. So, thank you so much for doing that. It's incredibly helpful. Thank you for having me. It's my pleasure.
I see that there are a few other questions, I think, from the chat and in Slido, but I just wanted to remind people that you can ask questions where you are on YouTube or LinkedIn, but you can also ask questions anonymously on Slido. And one of those questions was, how do we ignore the .R project and Git ignore an initial push to GitHub if you only want the code files in GitHub?
So, if I show you the Git ignore, you should like just, if I'm wrong, okay, let me go to, so because normally Polybring, in the Git ignore file, if you try to open it, you should get the extensions of the file that you want Git to ignore. So, as I know, you should have the list of the extensions of the file that you want that Git ignore, okay?
But thank you. Yeah, I see. There was another question that actually was over on the meetup discussion, which I usually don't see questions there, too. So, great to see that there as well. But Mike asks, what are effective project management structures with GitHub, keeping just the code? Mike said, I have used data, code, and com as folders under the respective project parent, but this can lead to a myriad of repositories and folders and would like to limit these.
Yeah, I will also recommend like having a folder when data, maybe when you should have your data sets, having the codes in another folder. And if you have some slides, some presentations, some other useful files, I would say.
I will, yeah, sure. So, it's okay. I will have a look at the error at Google, first of all. Yeah. Especially Stack Overflow, but I would really recommend the book of Jenny Bryan, because there is an interesting part about troubleshooting, the frequent errors that you may get. So, this is like my first move. So, I will move to this book, and then I will try to search also on the GitHub documentation, or just, you can also reach out to me if I can help. It's okay.
Awesome. Thank you so much. I want to also, oh wait, someone else just asked a question. JD, or apologies if I pronounce your name wrong, but you said, thank you, how often do you recommend committing and pushing? Should we push every commit?
Yeah, good question. Yeah, because everything, when you made a commit, like every change you made will be saved and will be like displayed for your collaborators. So, like make a commit when you are really sure that will be useful for tracking later. Don't like just make a commit for maybe change some applications, like a commit which is worth it. So, I don't really recommend to make many commits. I don't want to make the same number, because it depends if your project is complex, is composed of many, many steps during this project, but I won't recommend doing so many commits.
Thank you. So, one other question is, if you're just starting using GitHub, and you want to use it for like your own private project, and you don't want everybody to be able to see your code, what do you recommend? It's okay. You can make your GitHub repository private, because I also did this before making my files public. It's okay to opt for a private repository. So, GitHub allows you to do so.
Great. I see one other question that just came through on YouTube is, how do you manage a public repo? How do you get the community outside your project to interact with your code? Yeah, you can go through this through the issues. So, this is like a thread, like when you have some discussions, and like you get interactions on your maybe some suggestions of improvements. Maybe I didn't cover the issues, but I would recommend like going through the issues, having some issues on the, like an imported repository, like for example, the cheat sheets repository. I can see many requests to have, to improve the, some requests to improve the repositories, the cheat sheets provided today.
