Advertisement
GalinaKG

Git commands

Apr 3rd, 2023 (edited)
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. git init: Initializes a new Git repository.
  2.  
  3. git clone [repository_url]: Clones a Git repository from the specified URL to your local machine.
  4.  
  5. git add [file]: Adds a file or directory to the staging area.
  6.  
  7. git commit -m "[commit message]": Commits changes to the local repository with a message describing the changes.
  8.  
  9. git push: Pushes changes to a remote repository.
  10.  
  11. git pull: Fetches and merges changes from a remote repository.
  12.  
  13. git status: Displays the status of files in the working directory.
  14.  
  15. git log: Displays a history of commits.
  16.  
  17. git branch: Lists all the branches in the repository.
  18.  
  19. git checkout [branch_name]: Switches to a different branch.
  20.  
  21. git merge [branch_name]: Merges changes from the specified branch into the current branch.
  22.  
  23. git remote: Lists the remote repositories associated with the local repository.
  24.  
  25. git fetch: Downloads changes from a remote repository, but does not merge them.
  26.  
  27. git diff: Shows the differences between the working directory and the last commit.
  28.  
  29. git reset: Resets the repository to a previous commit.
  30.  
  31. git config: Used to set configuration options for Git on a global, local, or per-repository basis.
  32.  
  33. git stash: Temporarily saves changes that are not ready to be committed, allowing you to switch branches or work on other tasks.
  34.  
  35. git tag: Marks a specific commit with a tag, allowing you to easily reference it in the future.
  36.  
  37. git blame [file]: Shows who made each change to a specific file and when.
  38.  
  39. git remote add [remote_name] [remote_url]: Adds a new remote repository to the local repository.
  40.  
  41. git revert [commit]: Reverts the changes introduced by a specific commit, creating a new commit that undoes the changes.
  42.  
  43. git cherry-pick [commit]: Applies the changes introduced by a specific commit to the current branch.
  44.  
  45. git submodule: Used to include a Git repository as a subdirectory of another Git repository.
  46.  
  47. git bisect: Helps you locate a specific commit that introduced a bug by performing a binary search through the commit history.
  48.  
  49. git reflog: Shows a log of all Git commands that have been run in the repository, even if they have been undone or removed.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement