Git, Github and Version Control Flashcards
What is the best practice when writing the commit message?
It’s best practice to use the present tense.
What are some Git commands for the terminal?
git init (Intialise Git) git status (See the status of the files in Git) git add (Add something to Git) git add . (Add all the files in a directory) git add .gitignore (dot infront of file name will create a hidden file) git commit -m "" (Commit message) git push (push changes) git log (see when which commits were made)
What is “Working Directory”?
It’s the folder or directory where you initialise your Git repository.
What is the “Staging Area”?
It’s a good place to figure out what are the things you want Git to ignore and what are the things you want Git to track
What is the “Local Repository”?
This is the repository that it pushed to Git.
What are the commands to revert changes made to a file before it’s pushed?
git diff index.html (Show changes that were made)
git checkout index.html (restore its previous version)
How do you create repository on Github via the command line?
git remote add origin (paste in the URL of the remote repository on github)
Conventional practice is that you name it origin
How do you push your local repository to the remote repository?
git push -u origin master
The master branch is the default branch of all of your commit
What is the “master branch”?
It is the main branch of your commits or save points. (Where your main progress is saved or committed)
What’s the command for removing all files and folders in a directory?
git rm –cached -r .
What is cloning and how can you do it?
git clone (url of repository from Github)
This pulls down all the commits and versions of a particular remote respository and stores the files inside your working directory.