Git Flashcards
git init
initializes a file as the local git repository (creates a git file on your local pc that is hidden)…or turns a current directory into a git repository
git add [file]
adds the file to the staging area (between your local pc and YOUR online repo)
git status
check status of working tree
git commit
commits changes from your staging area to YOUR repo
git push
pushes changes from local repo to a remote repo
git pull
pulls latest changes from remote repo into another repo (like someone else’s master branch or even your own master branch)
git clone
clones ANY repo into your personal directory on your pc
git config –global user.name ‘Mundy Reimer’ git config –global user.email ‘blah@blah.com’
configures our repo
git status
checks what’s in staging area (the 1st part is what we have in the staging area that has changes and needs to be committed. The 2nd part is what files are untracked)
git rm –cached [filename]
removes file from staging area (and are thus now untracked files)
git add *.[filetype]
adds ANY files of that specific type to the staging area
git add .
adds ALL files in the current directory to the staging area (any changes made locally will then still need to be updated to the staging area)
git commit -m ‘some random comment about your change’
commits and comments about it in one step
git branch [branch name]
creates a new branch
git checkout [branch you want to go to]
goes to branch you want to go to
what kind of file is .gitignore ?
a text file that whatever files or directories you type into it, git doesn’t commit those when committing the directory with the .gitignore file
git remote
lists the git remote repositories
git remote add origin [file].git
adds a remote repo called origin
git push -u origin master
pushes the file to the origin master branch
touch README.md
creates a readme markdown file that explains this repo and its contents
What is the commit “hash”?
the specific number that references a particular change in the history of commits of a file or directory
What is “master”?
By default, the original branch that you were working on
What is a “branch”?
Just a linearly series or history of commits (saved changes). If you branch off, then you will start getting parallel versions of a series of files
What is “merge”?
combining a branch back into another one
You can view the whole project’s history of commits, pushes, pulls, in what way?
Go to github > main repo page > insights > dependency graph OR network