Skip to content

Files

Latest commit

 

History

History
95 lines (48 loc) · 4.18 KB

git-commands-english.md

File metadata and controls

95 lines (48 loc) · 4.18 KB
  1. git init: Initializes a new Git repository in the current directory.

  2. git clone [repository URL]: Makes a copy of an existing Git repository to your local machine.

  3. git add [file/folder]: Adds changes to the staging area before committing them.

  4. git commit -m "message": Commits changes to the local repository with a descriptive message.

  5. git status: Shows the current status of the repository, including any changes that have been made.

  6. git log: Displays a log of all commits made to the repository.

  7. git branch: Lists all branches in the repository.

  8. git checkout [branch name]: Switches to a different branch in the repository.

  9. git merge [branch name]: Merges changes from one branch into another.

  10. git pull: Fetches changes from the remote repository and merges them into the local repository.

  11. git push: Uploads changes from the local repository to the remote repository.

  12. git remote add [name] [URL]: Adds a new remote repository to the local repository.

  13. git remote -v: Lists all remote repositories connected to the local repository.

  14. git diff: Shows the differences between the local repository and the staging area or working directory.

  15. git reset: Resets changes made to the repository, removing them from the staging area.

  16. git rm [file]: Removes a file from the repository.

  17. git mv [old file name] [new file name]: Renames a file in the repository.

  18. git tag [tag name]: Creates a new tag for a specific commit.

  19. git fetch: Downloads changes from the remote repository without merging them into the local repository.

  20. git stash: Saves changes made to the working directory for later use.

  21. git pull --rebase: Fetches changes from the remote repository and rebases them onto the local branch.

  22. git blame [file]: Shows who made each change to a specific file and when they made it.

  23. git cherry-pick [commit]: Applies changes from a specific commit to the current branch.

  24. git revert [commit]: Reverts changes made in a specific commit and creates a new commit to undo them.

  25. git show [commit]: Shows details about a specific commit, including its message and changes.

  26. git branch -d [branch name]: Deletes a branch from the repository.

  27. git branch -m [old branch name] [new branch name]: Renames a branch in the repository.

  28. git push -u [remote name] [branch name]: Sets the default upstream branch for a local branch.

  29. git checkout -b [new branch name]: Creates a new branch and switches to it.

  30. git log --oneline: Displays a short log of all commits made to the repository.

  31. git log --graph: Displays a graphical representation of the commit history.

  32. git merge --abort: Aborts a merge that is currently in progress.

  33. git commit --amend: Adds changes to the previous commit instead of creating a new one.

  34. git config --global user.name "[name]": Sets the name associated with Git commits.

  35. git config --global user.email "[email address]": Sets the email associated with Git commits.

  36. git config --global color.ui true: Enables colored output in Git commands.

  37. git stash pop: Applies the most recent stash to the working directory.

  38. git clean: Removes untracked files from the working directory.

  39. git remote rm [remote name]: Removes a remote repository from the local repository.

  40. git diff HEAD: Shows the differences between the local repository and the last commit.

  41. git reset --hard: Resets all changes made to the repository, removing them from the working directory.

  42. git reset --soft [commit]: Resets the repository to a specific commit but keeps the changes in the staging area.

  43. git pull --rebase origin [branch name]: Fetches changes from the remote repository and rebases them onto the local branch.

  44. git config --list: Lists all Git configuration settings.

  45. git show-branch: Displays a graphical representation of the relationship between different branches.

  46. git bisect start: Starts a binary search to find a bug in the repository's history.

  47. git bisect good: Marks a commit as good during a binary search.

  48. git bisect bad: Marks a commit as bad during a binary search.