Install Git on Ubuntu
sudo apt-get install git
Install Git on Windows
Msysgit is a Windows version of Git, downloaded from http://msysgit.github.io/, and then installed by default. After the installation is complete, find "Git" in the Start Menu | Git Bash ", jumping out of something like a command-line window, that means git installs successfully!
Configuration
Open the command line and enter the following code:
git config --global"YOUR NAME"git config --global"YOUR EMAIL ADDRESS"
Note that the parameters of the git config
command, --global
using this parameter, means that all of your git repositories on this machine will use this configuration, of course, you can also assign a different user name and email address to a warehouse.
Create a warehouse
- Click "+" in the upper-right corner of the GitHub page, then click "New Repository".
- Enter the name of the warehouse and its descriptive information.
- Select whether the warehouse is public or private (only paid users are allowed to create).
- Select "Initialize this repository with a README.".
- Click "Create Repository".
You can also enter it from the command line mkdir repoName
.
Submit Updates
- Click "Readme.md" in the list of files in the warehouse.
- Click the Edit button to make changes to the file, the file content has a preview button to preview the effect of the changes.
- Under "Commit changges", enter a simple and meaningful update information.
- Click "Commit Changes".
The final step is to create a pull request with this option in addition to the "Commit changes" option, "Create a new branch for this commit and start a pull request". The administrator can click on "merge pull request" to merge the results. If you are merging from the command line, follow these steps:
Step 1:from your project repository, bring in the changes and test.
git fetch origin
git checkout -b chinaeagle001-patch-1 origin/chinaeagle001-patch-1
git merge master
Step 2:merge The changes and update on GitHub.
git checkout master
git merge --no-ff chinaeagle001-patch-1
git push origin master
Fork A repo example of creating a branch
- On GitHub, navigate to the Octocat/spoon-knife repository.
- Fork Buttonin The Top-right corner of the page, click Fork.
The synchronization branch creates a local clone of the branch.
- On the GitHub page, navigate to your branch and copy the URL of the branch.
- Open the command line and enter:
git clone https://github.com/YOUR-USERNAME/Spoon-Knife
.
- Enter, the local clone is created.
Configure GIT to synchronize the branch with the original warehouse
- on GitHub, navigate to the Octocat/spoon-knife repository.
The
- copies the URL of the original warehouse.
-
Enter git remote-v
at the command line and click Enter to see the remote repository of your branch currently configured.
git remote-v
Origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
origin Https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
-
Enter git remote add upstream
, then paste the copied URL and click Enter.
git remote add upstream https://github.com/octocat/Spoon-Knife.git
- at this point, enter
git remote-v
again to see the following message:
git remote-v
# Origin https://github.com/ Your_username/your_fork.git (Fetch)
# Origin Https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
# upstream Https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch)
# Upstream Https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push)
You can now synchronize the branch with the original repository with a few git commands.
git fetch upstream
git checkout master
git merge upstream/master
The sky's the limit with the changes your can make to a fork, including:
- Creating branches: branches allow you to build new features or test out ideas without putting your main project At risk.
- Opening Pull requests: If You is hoping to contribute back to the original repository, you can send a request To the original author-pull your fork into their repository by submitting a pull request.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
GitHub Use Notes