Git Commands
Git Commands
git add [file]: Adds a file to the staging area. You can also use git add . to add
all files.
git status: Shows the status of changes in the working directory and staging area.
git diff: Shows the differences between the working directory and the staging area.
git diff --staged: Shows the differences between the staging area and the last
commit.
git branch: Lists all local branches. Use -r to see remote branches and -a to see
all branches.
git merge [branch-name]: Merges the specified branch into the current branch.
git push [remote] [branch]: Pushes commits from your local repository to a remote
repository.
git pull [remote] [branch]: Fetches changes from a remote repository and merges
them into the current branch.
git reset [file]: Unstages the file, but leaves its contents unchanged.
git reset --hard: Resets the staging area and working directory to match the most
recent commit.
git rm [file]: Removes a file from the working directory and stages the deletion.
These are just some of the most commonly used Git commands. Git has a wide range of
commands and options for various workflows and scenarios. You can find more
detailed information in the Git documentation or by using git help followed by the
command you're interested in.