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

Git command and Github

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

Share

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

Basic operation

Create a new warehouse Test on Github, do not initialize it, then install Git locally, create a directory with the same library name, Test, and enter the directory. Right-click Git Bash HERE and follow the following command:

Echo "# Test" > > README.md

Git init

Git add README.md

Git commit-m "first commit"

Git remote add origin https://github.com/erryeng/Python-practices.git

Git push-u origin master

* pull the project locally from the Github website

Local installation SSH address of the copy project on the gitGithub website create a new folder locally to enter this folder, and then Git Bash Here run the command: ssh address of git clone copy * *

The command explains:

Git init

Initialization, which will create a subdirectory called .git (the files in the project have not been tracked yet)

Git add README.md (git add * .py)

Track files

Git add.

Commit all changes to the staging area, including file content modification (modified) and new files (new), but excluding deleted files

Git add-A

All, including add and non-add

Git commit-m "first submission"

After tracking the file, submit it

Git remote add origin https://github.com/jerryfeng007/Python-practices.git

Add a remote repository (later, you can use origin instead of the entire url)

Git push-u origin master

Push the local master branch to the origin host, and specify origin as the default host, then you can use git push without any parameters.

Create a development branch development project

Create a new branch on github develop view remote branch, git branch-r local new branch, git branch develop view local branch, git branch view all branches, git branch-a view current branch, git branch-a, switch to develop branch with *, git checkout develop view current branch, with *, git branch-a development completed, git add (such as git add * .py) git commit-m "submission time" Submit content, etc. "submit to the develop branch, git push origin develop to check whether the github has been modified by push. At this time, if the master is modified by someone else, then you are not up to date locally. Switch to the local master branch, git checkout master pulls the latest code, git pull origin master merges the code on the develop branch into the master,git merge develop view status, and git status submits to the remote master,git push."

Other

Delete the local branch, git branch-d test2 delete the remote branch, git push origin-- delete test2

After the branch is deleted from Github, it is viewed locally using git branch-a, and still exists

Execute orders, git remote prune origin

Use git branch-a to view again and delete 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