Git is an Open Source Distributed Version Control System.
The best way to learn git is probably to first only do very basic things and not even look at some of the things you can do until you are familiar and confident about the basics. – Linus Torvalds
❯ git init // create an empty repository
❯ git clone <https://github.com/USER/REPO>
❯ git add file (.) // add file on stage
❯ git add -p // split diffs into patches
❯ git commit -a -m "Message" // -a (add new changes on file) -m (message)
❯ git commit -a -m "Message" --amend // replace message
❯ git rm file.txt // remove file from stage
❯ git status // check directory status and stage
❯ git diff // display the changes between local and remote branch
❯ git log // list information about the last commits
❯ git push origin main // copy commits from local to remote branch
❯ git pull origin main // copy commits from remote to local branch
❯ git branch name // create a new branch
❯ git checkout name // enter on the branch
❯ git branch -d name // remove a branch
❯ git push -u origin name // push the local branch into remote
❯ git merge name // merge branch with new code into main
❯ git reset --soft HEAD~2 // reset the last 2 commits
❯ **.gitkeep**: to keep the file on GitHub when on .gitignore you put to ignore the folder.
- on .gitignore: tmp/*
- on .gitignore: !tmp/.gitkeep
<aside> 💡
</aside>