These commands as a reference for your daily Git workflow.

These commands as a reference for your daily Git workflow.

  1. Initialize a New Git Repository: Use git init to start a new Git repository in your project directory.
  2. Clone a Repository: Clone an existing repository to your local machine using git clone [repository URL].
  3. Stage Changes: Add changes for the next commit using git add [file]. You can also use git add . to stage all changes.
  4. Commit Changes: Commit staged changes with a message using git commit -m "[commit message]".
  5. Check Repository Status: See the current status of your working directory with git status.
  6. View Commit History: Review the commit history with git log.
  7. Pull Remote Changes: Fetch and merge remote changes into your local branch using git pull.
  8. Push Local Changes: Push local commits to the remote repository with git push.
  9. List Branches: List all branches in your repository using git branch.
  10. Create a New Branch: Create a new branch with git branch [branch name].
  11. Switch Branches: Switch to a different branch with git checkout [branch name].
  12. Merge Branches: Merge changes from one branch into the current branch using git merge [branch name].
  13. Stash Changes: Temporarily save changes for later with git stash.
  14. Fetch Remote Changes: Download remote changes without merging using git fetch.
  15. List Remote Repositories: View remote repositories associated with your local repository with git remote -v.
  16. Add Remote Repository: Add a new remote repository with git remote add [name] [repository URL].
  17. View Differences: See the differences between your working directory and the last commit with git diff.
  18. Unstage Changes: Unstage changes for a file with git reset [file].
  19. Discard Local Changes: Discard local changes in a file and revert to the last committed state with git checkout -- [file].
  20. Graphical Commit History: Visualize the commit history with a graphical representation using git log --graph --oneline --all.#developers #phpdevelopers #nodedevelopers #Reactdevelopers

要查看或添加评论,请登录

Arvind Kumar的更多文章

社区洞察

其他会员也浏览了