GIT Flashcards
Working with Git hub and Cheat Sheets
How do you set up global credentials for all repositories?
git config –global user.name “Your Name”
git config –global user.email “you@example. com”
What do you do if you want to start a new git repository?
Navigate to your project directory and run:
git init
Downloads a project with the entire history from the remote repository.
git clone URL
Displays the status of your working directory. Options include new, staged, and modified files.
git status
Add a file to the staging area. Use. in place of the full file path to add all changed files from the current directory down into the directory tree.
git add [file]
or
git add .
git commit -m “Message”
Create a new commit from changes added to the staging area. The commit must have a message!
Add a file to the staging area. Use . in place of the full file path to add all changed files from the current directory down into the directory tree.
git add [file]
or
git add .
Show changes between working directory and staging area.
git diff [file]
Shows any changes between the staging area and the repository.
git diff –staged [file]
Discard changes in working directory. This operation is unrecoverable.
git checkout – [file]
Revert some paths in the index (or the whole index) to their state in HEAD.
git reset {<path>...]</path>
Remove file from working directory and staging area.
git rm [file]
How can you verify that the .git folder was created?
ls -a
How do you check if a folder is a git repository, if there are untracked files, staged files, or the working directory is clean?
git status
How do you remove git tracking from a project?
rm -rf .git
Navigate to the home directory
cd ~
navigate to the root directory
cd /
Move one level up in a directory tree
cd ..
Show the current directory path
pwd
List all files and directories in the current location
ls
List all files including hidden files like .git
ls -a
Clear the terminal screen
clear
What are untracked files?
Files not yet added to git
What are files that have changes but are not yet staged?
modified files