𝕴 𝖉𝖔 𝖒𝖆𝖌𝖎𝖈

Beginner's Guide to Git Common Commands Summary


Git is an open-source distributed version control system. My understanding is that it is a tool for fetching files from a remote server to the local machine and supports uploading files from the local machine back to the server. It is widely used on platforms such as GitHub and GitLab. For example, it can be used by individuals to quickly upload files to the platform or by teams to upload code to a shared repository. The most important feature is that it shows the changes made to the files each time they are uploaded, making it convenient for teams to reference and use.

Most Common Commands#

git clone —— Clone files from the server to the local machine
git status —— Check and list modified files
git add {fileName}—— Commit changes
git add . —— Commit all changes
git commit -m '#' —— Add push comments #
git branch {branchName}  —— Create a new branch
git switch {branchName} —— Move to a branch
git switch {branchName}^ —— Move to the parent commit of a branch
git switch {branchName}~x —— Move x levels up from the branchName branch
git reset {branchName} —— Return to the branchName branch
git rebase {branchName} —— Merge changes based on the current branch
git merge {branchName} —— Merge the changes from the branch into the current branch

So what's the difference? Which one should you use?
git rebase VS git merge? A more elegant way to merge in git

git commit -m '#' —— Add push comments #
git push —— Push the modified files to the remote server
git pull —— Fetch updated files from the remote server to the local machine (assuming there are updates on the remote server)


Git Reference https://git-scm.com/docs
Git Basic Operations | Runoob Tutorial https://www.runoob.com/git/git-basic-operations.html

Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.