Operating on to submit code to the main repository GitHub's git using the command

1. The need to put down the main warehouse clone

use git clone https://github.com/XXX/(主仓库)

PS : If you do not clonemaster the warehouse, then in subsequent operations which, for example, there will be some conflict to the main warehouse PR (Pull requests), when the emergence of this conflict of reason may be because their warehouse contents can not completely cover the main repository of content, that is less than the contents of the main warehouse, leading to merge into the main warehouse.

2. Find your branch

Use git branch -aview all branches

PS : If you do not own branch, this step can be omitted.

3. Create a local repository GitHub and remote branch warehouse

use git checkout -b test(本地仓库的名字) origin/分支名

PS : git checkout -bThis command is meant to generate locally called testlocal repository, content with origin/分支名the contents of this branch is the same, and enter the local branch.

GitHub repository to establish remote branch two ways

1. On GitHub page, its own warehouse directly establish branch
2. Use the git command to establish branches git branch test
PS : a local warehouse of the same name established here must keep the remote branch.

4. According to its mandate to amend the related files (add, delete, change)

The local content packetizes

1), git initthe warehouse management can become a git repository.

2), git add .add files to the repository

3)、git commit -m "本次提交代码的一个cmmmit"

6. Modify .git/configfile

Use vim .git/configthe command into the file to be modified

PS : Use i或者insertstart modifying files, ** [Tremote: origin] ** the URL into their own fork of the repository on github, use after modifications are complete ESCexit modify, use the shift+ command mode, enter the wqexit vim.

7. The local repository testto upload to your own warehouse branch testin

Use the commandgit push -f origin test

PS : As used herein, -fthe meaning is to use a local repository testforced to cover the remote branch test.
The first time you upload the code, but also landed a personal account, use the command:

git config --global user.email "[email protected]"
git config --global user.name "yourname"

Then the input box will pop up to let you fill in a username and password, simply fill out the GitHub account number and password can be.

Released nine original articles · won praise 2 · Views 103

Guess you like

Origin blog.csdn.net/jocker_775065019/article/details/104462664