What are the main Git commands you know?
sobes.tech AI
Answer from AI
git init - initialize a new repository.
git clone <url> - clone an existing repository.
git add <file> - add changes from a file to the staging area.
git add . - add all changed files to the staging area.
git commit -m "commit message" - create a new commit with a message.
git status - display the current status of the repository.
git log - view commit history.
git push - push commits to a remote repository.
git pull - fetch changes from a remote repository.
git branch <branch_name> - create a new branch.
git checkout <branch_name> - switch to another branch.
git merge <branch_name> - merge changes from the specified branch into the current one.
git diff - show changes between the working directory and the staging area, or between the staging area and the last commit.
git remote add origin <url> - add a remote repository.
git remote -v - view the list of remote repositories.
# Example of adding a file to the staging area
# git add my_file.py
# Example of committing
# git commit -m "added authorization feature"