Skip to content
Hani fares edited this page Mar 23, 2022 · 18 revisions

Welcome to the git-cheat-sheet wiki!

Git as course:

  1. What is Git?
  2. Theoretical Git.
  3. How to install Git on your machine?
  4. Start using Git: Make a new project, create on file, then init a git repo. Then add it and commit it.

Creating Branches and switch between them.

Git log: to see and check all commits and Heads

Head: is the last commit in a branch.

Detached Head: is when you switch to one commit. this commit will be the detached head

Git ls-files: show all files in staging area

When you delete a file from working area, it still in staging area, you have also to delete it from the staging area.

To delete a file from the staging area, you have two ways:

  • git add that will add all existing files to the staging area (under the hood will delete the deleted file)
  • git rm <file_name> that will remove the delete file from the staging area

To delete the unstaged changes: git checkout/restore <file_name> // to delete unstaged changes in certain file git checkout/restore . to go back to last head.

Clone this wiki locally