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

How to pull the substitution code locally by git

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This post is about how git pulls code locally. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.

The method for git to pull the code to the local repository is: first open the git command window, enter the command [git clone github repository address]; then enter to pull the code to the local repository.

Step 1: Pull remote code

git clone https://github.com/…/PrettyGirls.git

Step 2: View local and remote branches

1, cd PrettyGirls to the project directory;

git branch -al View all branches locally and remotely.

Here you see all branches successfully: where master is the local branch and the asterisk * in front indicates the branch in use

Branches preceded by remotes are remote branches.

Step 3: Associate remote branches with local branches

1、git pull origin master

(If you want to pull to the local dev branch, first git checkout -b dev, then git pull origin dev, thus binding the local dev branch to the remote origin/dev)

This command associates the local branch with the remote branch and pulls the remote branch origin under the local branch master

If there is a child branch 1.0.0.1 under the remote branch origin, use git pull origin/1.0.0.1 master to bind the local master branch to the remote origin/1.0.0.1.

2、git branch -vv

You can see the blue origin/master after master, indicating that the master branch has been bound to origin/master.

3, has been associated with the good code, directly enter git pull can be synchronized

Step 4: Upload local code to remote branch

1、git add . (You can fill in the complete path, the dot means all the files under the directory)

add you have modified the local file acb.txt here is the relative path

2、git commit

Using git commit is to upload this txt file to the local branch

3、git push

The result of this command is to upload the commit data abc.txt from the local master branch to the remote master branch

Thank you for reading! About "git how to pull code to the local" this article is shared here, I hope the above content can have some help for everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!

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