How to grad school: CV version control and Git

My personal goal for this academic year is to develop the good habits that I’ve been putting off. Possibly the most important of these habits is version control. Today as I was updating my CV, I realized this would be a good opportunity to make life easier for Future Me. It took a lot of searching the internet for bits and pieces of useful code, so I’ve compiled it into a nice document for future reference!

Before any of this you need to install Git and make it talk to GitHub. Jenny Bryan has great step-by-step instructions here, so I won’t go into that.

So, assuming that you have Git installed and talking to Github, let’s go!

*Note: These instructions are for Mac. Sorry, I’m not sure if it’s different for a PC.*

1. Make a new repository on Github.

Screen Shot 2018-08-23 at 1.51.18 PM

Give it a good name and click the “Initialize this repository with a README”. Create repository!

2. Clone repository.

Now that you’ve created a repo, click the “Clone or download” button and click the icon to copy the url to your clipboard.

Screen Shot 2018-08-23 at 2.01.21 PM

3. Open the command line.

Change your current working directory to where you want the cloned repo to go.

Screen Shot 2018-08-23 at 2.05.31 PM

4. Clone the repo.

git clone <URL>

Paste the GitHub repo URL after “git clone”.

5. Make sure everything is okay.

git status

This command let’s you check the current state of your repository and the files it contains. It should say: on branch master, your branch is up-to-date with ‘origin/master’, nothing to commit, working tree clean.

Double check that you’re still in the working directory that you want.

6. Update directory and check status.

Update your CV (gotta keep that up to date!). Once you’re done making changes to your local directory, you need to update your GitHub repo.

git status

Now that you’ve updated files, this command will show the status of files. The updated CV will appear under the heading “untracked files“.

*Note: Git doesn’t recognize file names with spaces.*

7. Add file and commit.

git add <FILE-NAME>

This adds your file to the staging area and it will be part of the next commit.

git status

Your file’s status is now under the heading “changes to be committed”.

git commit -m “your message”

“Commit” means that Git will take all the staged files and store them as a single unit under version control. Write yourself a useful message so that you’ll remember what you did. For example: “Updated date”, “fixed typos”, etc.

git log

This shows a history of commits. Use :wq to exit log.

8. Push to Github

git push

This updates the GitHub repo with the committed changes.

Congratulations! You did it!

Bonus: Pull from Github

If you make changes to Github but not your local directory, make a Git pull request.

git pull


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s