Using Git - Social-Developmental-Neuroscience-Lab/general GitHub Wiki

Git

Have you ever made irreversible damage to your files for your project? Git is a version control system that ensures 'checkpoints' along your way. A checkpoint in Git is called a commit which you save, or push. For a quick and minimal tutorial start here. WARNING! Never put private information in a Git repository. These mistakes are hard to fix and could result in serious consequences. Just don't do it! ☠ You'll want to make a GitHub account to keep track of all of your repositories here.

Here is a cheat sheet of common Git commands. <> mean that you should be replacing them with something- don't actually type the <> symbols! 😉 git init <directory> #start a git repository git clone <repository> #clone a repo, i.e. over ssh

#links commits to your account, makes commits faster :) git config user.name <gitUserName>

git add <directory> #adds file to staging area git commit -m "<message>" #commit added file to repository

#make sure commit messages are useful #not useful git commit -m "blah blah blah changes" git commit -m "qwerty" git commit -m "fniurbiuviu3248394n4f8h4q4"

#useful git commit -m "fixed import error" git commit -m "added csv to BIDS script"

#utilities git status #list files which are untracked, staged, or unstaged git log #view commit history git revert <commit> #revert to previous commit, use the log!

#Working with remotes git pull <remote> #get changes git push <remote> #save changes to remote

⚠️ **GitHub.com Fallback** ⚠️