Git distributed version Control tutorial

Source: Internet
Author: User
Tags diff version control system git commands

Git distributed version control

Git installation Configuration

Linux&unix Platform

debian/ubuntu$ apt-get install gitfedora$ yum install git (up to Fedora) $ DNF install git (Fedora and later) gentoo$ Emerge--ask--verbose dev-vcs/gitarch linux$ pacman-s gitopensuse$ zypper install gitfreebsd$ cd/usr/ports/devel/git$ m Ake installsolaris express$ pkg install developer/versioning/gitopenbsd$ pkg_add git



Windows
Official website: Https://git-scm.com/download/win

Mac
: https://sourceforge.net/projects/git-osx-installer/

Git Configuration
Set user name and email

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


View configuration information

git config--list


Working with GIT Distributed version control system workflow

Cloning data to the local machine working directory
Locally established branch, modify code
Commit code on a branch of your own establishment
Merge the branch with the main branch after the modification is complete
Push local code to remote server
The version warehouse administrator audits, using the Allow push


Three big open source sites

SourceForge
CodePlex
Github

Common git commands

Initialize && clone

Git init git clone


Build a project

Add (adding files to the cache) & Commit

git add *git Add README

Add buffer content to the warehouse,-M provides commit comments on the command line

Git commit-a-M "Init project Version"


Status Check file state

git status
Ignore file ignores specified files cat. gitignore Ignore file vim. Gitignore add ignored Files diffgit diffgit diff--stagedgit diff--cached

To view cached changes


Git reset HEAD is used to cancel cached content
git reset HEAD--hello.jsp

Git rm removes files from the cache and your hard drive (working directory)
git rm hello.jsp


Git mv Rename the files on the disk with the same effect as the git rm--cached command

Git fetch is getting the latest version from remote to local

Git fetch Origin mastergit log-p Master origin/mastergit Merge Origin/master


Git pull gets the latest version from remote and merges to local

Git pull Origin Master


This article is from the Java Technology Blog blog, so be sure to keep this source http://lingdong.blog.51cto.com/3572216/1889164

Git distributed version Control tutorial

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.