Git uses detailed tutorials __git

Source: Internet
Author: User
Tags using git

Git using tutorials

General description

The following steps are described by using git created from scratch and uploaded to the remote repository.
The real use of Git is to use its powerful distributed management features, and we will try to create a branching version control.
Git's remote repository can be divided into three types:
The Open Remote Warehouse-github (https://github.com) is the choice, the world Programmer's Open source paradise;
Private third party remote warehouse-code cloud (https://git.oschina.net/) domestic Oschina imitate the GitHub of a product, vowed to do the Chinese GitHub;
Self-built remote warehouse-gitstack (a fast build git remote warehouse software).
Required Software Git-2.10.2-64-bit.exe and Gitstack_2.3.9.exe

Steps
Install Git-2.10.2-64-bit.exe:

No brain next, no special needs, all the default options.

The first time you use Git, you need to configure a global user information that is simply a token that will not be validated by the mailbox and will no longer need to be configured:

git config--global user.name "Your name"
git config--global user.email "email@example.com"

Find a location create a new folder, initialize the Git repository

Initializing warehouse git init
Add all files under the directory to registers git Add./
Submit staging file to local warehouse git commit-m "This submitted comment"

To view the local warehouse branch, create a development branch

View all local branches and the branch (with the asterisk) Git branch
Create Dev Branch (usually development is a new branch, such as Dev,master is the backbone, the general release will be used) Git branch dev
Switch to Dev Branch for development work git checkout dev

Using code cloud to create remote warehouse

Use third party private remote libraries as a priority from a security and cost perspective

Register Login Code Cloud https://git.oschina.net/
Creating a private remote repository

To add a connection to a remote warehouse

Add readme.md to the project root, which will automatically be read in the code cloud and GitHub, as a project presentation on the project homepage
Added new files, need to be added to registers and submitted to local repository, note current in Dev branch
git Add./
git commit-m "Submit Comments"
To add a remote warehouse to the local git remote add remote warehouse to mark the location
View all local remote repositories git remote-v
Remove the specified remote warehouse git remote RM repository token
Add remote warehouse git remote add githost https://git.oschina.net/scsf/GitDemo.git

Pushing local code to a remote repository

Push local code to a remote repository (and create a remote dev branch) git push githost dev
Input code cloud account name and password

View Remote Warehouse Dev Branch

Merging local files and remote warehouse files to resolve conflicts

Switch to MAIN branch checkout Master
Pull up the remote warehouse Master branch code and find conflict git pull Githost master

Because we created a remote warehouse automatically generated some files, and a conflict with the local file, where the "strong push" in the form of a local file to cover the remote repository Master branch, or it will appear error:failed to push some refs to ' https:// Git.oschina.net/scsf/gitdemo.git ' Such a mistake

             git push-f githost Master      

Look at the remote warehouse again, and the discovery will be consistent with the local

Complete screenshot of all the above commands

Here to write a picture description

Common commands

 > I can do most of the routine.

Mixed for a few months, found that later really not go on, only determined to learn.
Git init initializes the warehouse git Add./Add the current directory into the warehouse git commit-m "Init" commits to the local repository. Git remote add origin http: .... Pull Project git remote RM Origin remove current project git remote-v view log Git push origin master commits to remote warehouse Git pull Origin master pulls remote warehouse content 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.