GIT Flashcards
What command is used to start a git repository in a folder?
git init
What are the three parts of a git project?
1) A Working Directory: Where you do all the work: creating, editing, deleting and organising files.
2) A staging area where you will list changes made to the working directory
3) A Repository: Where GIT permanently strores these changes as different versions of the project.
What is the command to save changes made in the working directory?
git commit
What is the command to add untracked files to the staging area?
git add
What does git status do?
Checks the status of the changes you have made to the working directory
What is an untracked file?
An untracked file means that GIT sees the file but has not started tracking changes yet.
How can you check the changes between the staging area and the working directory?
git diff
What is the command added to git commit to add a comment to the commit?
-m ‘text goes here’
What does git log do?
Gives you a list of your commits.
What is the HEAD commit and what does git show HEAD output?
The HEAD commit is the commit you are currently on. The output of the command shows everything the git log command would show and also the file changes that were committed.
How would you restore the working directory to the last commit you made?
git checkout HEAD changes.txt
How do you remove a file from the staging area?
git reset HEAD changes.txt
What do you add to git reset to revert to a specific commit?
The first 7 characters of the SHA of a previous commit. A SHA looks like ‘5d692065cf51a2f50ea8e7b19b5a7ae512f633ba’
What command can be used to check what branch you are on?
git branch
The * in the output indicates what branch you are on
What command is used to make a new branch?
git branch name_of_new_branch