Git is an open source distributed version control system used to handle any project, small or large, agilely and efficiently. Git is an open source version control software developed by Linus Torvalds to help manage Linux kernel development. Git is different from commonly used version control tools such as CVS and Subversion. It uses a distributed version library and does not require server-side software support.
Common Git commands
Switch to the main branch
git checkout master
Create a new branch and switch to this branch
git checkout -b new_branch
Switch to the main branch Branch, merge other branches
git checkout master git merge new_branches
Submit changes to the staging area
git add -A
Submit changes to the local repository
git commit -m "备注"
Delete files in the current directory that are not tracked
git clean -df
Commit changes to the server repository
git push
Test the code and roll back
First, the version tag
git add -Agit commit -m "版本标记"
because after that, we Will roll back to this place.
Discard all file modifications:
git checkout .
Check the status:
git status
If you find that there are still some newly created files, then:
git clean -f -d
(Force to clean the files, even Clear the folder together)
Then check again:
git status
Find that everything is clean.
Initialization settings
Add folder contents to version management
git init
Set email address
git config --global user.email "you@example.com"
Set user name
git config --global user.name "Your Name"
Generate SSH public key
Many Git servers use SSH public keys for authentication.
If you want to provide an SSH public key to the Git server, you must generate one yourself first.
If you are not sure whether you have the SSH public key, you can enter
cd ~/.ssh && ls
in Git Bash to check.
If you see the pair of files id_rsa
and id_rsa.pub
, it proves that your computer has the key. .pub
is your public key, and the other is the corresponding private key.
If such a file cannot be found or the .ssh
directory does not exist at all, then you need to enter the
ssh-keygen
command in Git Bash to create them.
If you do not want to use a password to protect your key, just leave it blank when creating the query (press Enter to execute directly).
After that, you can use the universal notepad to open id_rsa.pub
, copy the contents, and add it to the Git server or website.
Recommended: "Git Tutorial"
The above is the detailed content of Summary of commonly used Git commands [recommended collection]. For more information, please follow other related articles on the PHP Chinese website!

Git is a distributed version control system, and GitHub is a Git-based collaboration platform. Git is used for version control and code management, while GitHub provides additional collaboration features such as code review and project management.

Git is a distributed version control system, and GitHub is an online platform based on Git. Git is used for version control, branch management and merger, and GitHub provides code hosting, collaboration tools and social networking capabilities.

Git is a back-end version control system, and GitHub is a front-end collaboration platform based on Git. Git manages code version, GitHub provides user interface and collaboration tools, and the two work together to improve development efficiency.

Git is a version control system, and GitHub is a Git-based code hosting platform. Git is used to manage code versions and history, and GitHub provides code hosting and collaboration capabilities. Git is suitable for all projects that require version control, GitHub is suitable for team collaboration and open source projects.

Git is a distributed version control system, and GitHub is an online platform based on Git. Git provides version control features such as branch management and commit history; GitHub provides collaboration tools such as code review and project management.

Git and GitHub are the core tools of modern software development. Git is a distributed version control system, while GitHub is a collaboration platform. Using Git and GitHub can improve development efficiency and enhance team collaboration.

Git is a distributed version control system created by Linus Torvaz in 2005, while GitHub is an online collaboration platform based on Git. Git records file changes through snapshots and supports branch models. GitHub provides tools such as PullRequest to improve collaboration efficiency.

GitHub is not just a version control tool, it also provides collaboration, project management and community communication capabilities. 1) Version control: Use Git to track code changes. 2) Collaboration: Submit code changes through PullRequest. 3) Project management: Use Issues and Project sections to manage tasks. 4) Community communication: Learn and communicate through fork and participating in open source projects.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
