Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the commonly used Git commands

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "What are the commonly used Git commands?" Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "what are the commonly used Git commands"!

Git is an open source distributed version control system for agile and efficient processing of any project, small or large. Git is an open source version control software developed by Linus Torvalds to help manage Linux kernel development. Git is different from the commonly used version control tools such as CVS and Subversion in that it adopts a distributed version repository approach without server-side software support.

Git common command

Switch to main branch

git checkout master

Create a new branch and switch to this branch

git checkout -b new_branch

Switch to main branch, merge other branches

git checkout mastergit merge new_branches

Commit changes to staging area

git add -A

Commit changes to the local repository

git commit -m "Remarks"

Delete files in the current directory that are not tracked

git clean -df

Commit changes to the server repository

git push test code and roll back

First, the version tag.

git add -Agit commit -m "Version tag"

Because after that, we'll roll back to this place.

Discard all file modifications:

git checkout .

Inspection status:

git status

Found some new files, then:

git clean -f -d

(Forced file cleanup, even folders)

Then check again:

git status

Everything was clean.

initialization setting

Add folder contents to version management

git init

setting mailbox

git config --global user.email "you@example.com"

set the 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 the SSH public key to the Git server, you must first generate one yourself.

If you are not sure if you have SSH public key, you can type it in Git Bash.

cd ~/.ssh && ls

to check.

If you see id_rsa and id_rsa.pub, prove that your computer owns the key.

The.pub is your public key and the other is your private key.

If you can't find such a file or if the.ssh directory doesn't exist, you'll need to type in Git Bash.

ssh-keygen

command to create them.

If you don't want to use a password to protect your key, leave the query blank (press Enter to execute).

After that, you can use the universal notepad, open id_rsa.pub, copy the contents, and add them to the Git server or website.

At this point, I believe that everyone has a deeper understanding of "what are the commonly used Git commands", so you may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report