Skip to content

Latest commit

 

History

History
77 lines (65 loc) · 1.01 KB

File metadata and controls

77 lines (65 loc) · 1.01 KB

Git Commands Reference

1. Initializing a Repository

  • Command:
    git init
    

2. Checking the Status of the Repository

  • Command:
    git status
    

3. Creating and Editing Files

  • Commands:
    touch <filename>
    vim <filename>
    

4. Listing Files in the Directory

  • Commands:
    ls
    ls -a
    

5. Adding Files to the Staging Area

  • Commands:
    git add <filename>
    

6. Removing Files from the Staging Area

  • Command:
    git rm --cached <filename>
    

7. Committing Changes

  • Commands:
    git commit -m "<commit message>"
    

8. Restoring Files

  • Command:
    git restore <filename>
    

9. Checking Commit History

  • Command:
    git log --oneline
    

10. Branching

  • Commands:
    git branch
    git checkout <branch-name>
    git switch <branch-name>
    

11. Clearing the Terminal

  • Command:
    clear
    

12. Exiting the Terminal

  • Command:
    exit