Git Commands
Git Commands
project.
simultaneously, with tools like GitHub and GitLab enabling easy sharing and
collaboration on code.
4. git add .: Adds all files in the current directory to the staging area.
5. git status: Displays the status of changes in the working directory and staging
area.
6. git commit -m "message": Commits the staged changes to the repository with a
descriptive message.
7. git log: Shows the commit history, including details about each commit.
9. git rm <file_name>: Deletes a file from the working directory and stages the
10. git checkout -- <file_name>: Discards changes to a file that have not been
staged.
14. git merge <branch_name>: Merges changes from the specified branch into the
current branch.
16. git merge --abort: Aborts a merge process if there are conflicts.
17. git push origin main: Pushes committed changes to the remote repository on the
specified branch.
18. git pull: Fetches and merges changes from the remote repository into the current
branch.
19. git fetch: Retrieves updates from the remote repository without merging them.
20. git stash: Temporarily saves uncommitted changes in a "stash" to clean the
working directory.
21. git cherry-pick <commit_id>: Applies the changes from a specific commit to the
current branch.