Most commonly used Git commands

Most commonly used Git commands:


git init: Initialize a new Git repository

git clone [repository-url]: Clone a remote repository to your local machine

git add [file-name/directory-name]: Stage changes for committing

git commit -m "[commit message]": Commit the staged changes with a message

git status: Check the current status of the repository

git diff: View changes between commits

git log: View the commit history

git branch [branch-name]: Create a new branch

git checkout [branch-name]: Switch to a different branch

git merge [branch-name]: Merge the specified branch into the current branch

git pull: Fetch and merge changes from a remote repository

git push: Push local changes to a remote repository

git stash: Save changes that haven't been committed for later

git reset [file-name/commit-hash]: Reset changes to a specific file or commit

This is just a small subset of Git commands, and there are many more available to use based on your specific needs.



Previous
Next Post »