Git Commands Flashcards
What is Git?
A version control system
Software that tracks and manages changes to files over time
Repository
A workspace which tracks and manages files in a folder
git status
Checks if I’m in a git repo and commits
also can announce if and what file has made changes
working tree clean means it’s up to date
git init
Initializes empty Git repository in chosen folder (start) - hidden - one per project
rm -rf .git
This will remove your entire git history for the project
git add Chapter1.txt
If seen modified we can use add command and group together to get ready to commit
Can be one file or multiple
save point - staging area - stage file to be committed
git commit -m “my message”
This is like a checkpoint of process of your text/code
This will name the checkpoint easy
git log
This show a log of the commits for a given repository
This will show the author,date and commit messages
git add .
This will stage all changes at once which is all files at once being worked on
Add what you missed then
git commit - - amend
To redo a commit message update if you made a mistake one commit ago
touch .gitignore
This creates a new file that will hide files or directories to save your hidden codes or and frameworks/libraries
git branch
List the current branches in the repository
git branch bugfix
This will create a new branch it can be best to create this in a new folder
~mkdir BugFixes
git switch Done or /git checkout
This will switch to this branch for the meantime
git switch -c Done
This will create a new branch and switch over all at once