Git
1. Clone
Clone a Git repository from a remote source to your local machine.
git clone repository_url
2. Init
Initialize a new Git repository for a project or reinitialize an existing one.
git init
3. Add
Stage changes for the next commit by adding modified or new files.
git add file_name
4. Commit
Save staged changes to the local repository with a descriptive commit message.
git commit -m "Your commit message"
5. Status
View the status of your working directory and see changes that need to be committed.
git status
6. Diff
Display the differences between various states, such as commits and the working tree.
git diff
7. Log
View a chronological log of commits with their hashes, authors, dates, and messages.
git log
8. Branch
Manage branches in your Git repository - list, create, or delete branches.
git branch branch_name
9. Checkout
Move between branches or restore files to a previous state.
git checkout branch_name
10. Merge
Combine changes from different branches into the current branch.
git merge branch_name
11. Remote
Configure connections to remote repositories where your code is stored.
git remote add origin repository_url
12. Fetch
Retrieve changes from a remote repository without merging them into your working directory.
git fetch origin
13. Pull
Fetch changes from a remote repository and integrate them into your current branch.
git pull origin branch_name
14. Push
Send your committed changes to a remote repository.
git push origin branch_name
15. Reset
Unstage changes or move the current branch to a specific commit.
git reset commit_hash
16. Revert
Reverse the changes introduced by a specific commit by creating a new commit.
git revert commit_hash
17. Tag
Mark specific commits as releases by creating lightweight or annotated tags.
git tag -a v1.0 -m "Release version 1.0"
18. Cherry-Pick
Select and apply specific commits from one branch to another.
git cherry-pick commit_hash
19. Stash
Temporarily save changes that are not ready to be committed.
git stash save "Your stash message"
20. Help
Access Git’s built-in documentation to get information about Git commands.
git help command_name