Git Basics Flashcards
(19 cards)
How to make a new directory?
mkdir directory
How do you initalize a directory to git?
git init
How to look at previous commits?
git log
How to look at the latest git commit?
git log -1
How to get the git commits compactly?
git log –oneline
How to configurate the git?
git config
How to create a new branch?
git branch new_branch
How to switch branches?
git switch diff_branch
How to switch and create a new branch?
git switch -c new_diff_branch
How to merge to the main branch?
git merge the_branch
How to delete a branch?
git branch -d add_classics
How to go back to the previous commit?
git reset –soft COMMITHASH
How to go to a previous commit and delete all the changes you made ahead of it?
git reset –hard COMMITHASH
What is the origin repo called if you have multiple?
main
How to ignore files so git doesn’t count them?
.gitignore
How to merge the remote repo with the branch?
git merge remote/branch
How to ignore all txt files?
*.txt
What does !important.txt do in the .gitignore?
This isn’t ignored
- important.txt is not ignored
What should be ignored?
- ignore dependencies, personal/specific things, passwords, things that can be generated