$ brew install git
$ sudo apt-get install
Shows the current version of your Git
$ git –version
git config –global user.name “Your Name”
git config –global user.email “youremail@example.com”
git config –global color.ui auto –
git init
git init <directory>
git clone <repository_url>
git clone –branch <branch_name> <repository_url>
git add <file>
git add . or git add –all
13. Shows the current state of your repository, including tracked and untracked files, modified files, and branch information.
git status
git status –ignored
git clone <url>
git config --list
git config --global alias.<shortcut> <command>
git clone –branch <branch_name> <repository_url>
git rm <file(s)>
git mv <old_file> <new_file>
git diff
git diff <commit1> <commit2>
git diff HEAD
24.Creates a new commit with the changes in the staging area and opens the default text editor for adding a commit message.
git commit
25. Creates a new commit with the changes in the staging area and specifies the commit message inline.
git commit -m “<message>” or git commit –message “<message>”
26. Commits all modified and deleted files in the repository without explicitly using git add to stage the changes.
git commit -a or git commit –all
git notes add
git restore <file>
29. Moves the branch pointer to a specified commit, resetting the staging area and the working directory to match the specified commit.
git reset <commit>
30. Create a new commit in a Git repository with a specific message to indicate a new feature commit in the repository.
git commit -m “feat: message”
git commit -m “fix: message”
32. Create a new commit in a Git repository with a specific message to show routine tasks or maintenance.
.
git commit -m “chore: message”
33. Create a new commit in a Git repository with a specific message to change the code base and improve the structure.
git commit -m “refactor: message”
git commit -m “docs: message”
35. Create a new commit in a Git repository with a specific message to indicate test-related changes.
git commit -m “test: message”
36. Create a new commit in a Git repository with a specific message to indicate performance-related changes.
git commit -m “perf: message”
37. Create a new commit in a Git repository with a specific message to indicate the changes related to the build process.
git commit -m “build: message”
38. Create a new commit in a Git repository with a specific message to indicate the changes related to revert a previous commit.
git commit -m “revert: message”
git branch
git branch <branch-name>
git branch -d <branch-name>
git branch -a
git branch -r
git checkout <branch-name>
git checkout -b <new-branch-name>
git checkout — <file>
git log
git log --oneline
git log --graph
git branch <branch_name>
git log –all
51. Stashes the changes in the working directory, allowing you to switch to a different branch or commit without committing the changes.
git stash
git stash list
git stash pop
git stash drop
git tag
git tag <tag_name> <commit_id>
git tag -a <tag_name> -m "tag message"
git tag -d <tag_name>
git show <tag_name>
git revert <commit>
git revert –no-commit <commit>
git rebase <branch>
git fetch
git fetch <remote>
git pull
git pull <remote>
git push
git push <remote>
git push <remote> <branch>
git push –all
git remote
git remote add <name> <url>
git remote rm <remote_name>
git remote update
git remote rename <old_name> <new_name>
git ls-files