Git distributed version Control tutorial

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

Git distributed version control

Git installation Configuration

Linux&unix Platform

debian/ubuntu$ Apt-getInstallgitfedora$Yum InstallGit (Up to Fedora +) $ DNFInstallGit (Fedora Aand later) gentoo$ emerge--ask--verbose dev-vcs/Gitarch linux$ Pacman-S gitopensuse$ ZypperInstallgitfreebsd$ CD/usr/ports/devel/git$ Make InstallSolaris Oneexpress$ PkgInstalldeveloper/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

" Lingdong "  "[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

" Init project version "


Status Check file state

git status


Ignore file ignores specified files
Cat. Gitignore Ignoring files
Vim. Gitignore Add ignored Files

Diff
Git diff
git diff--staged
git diff--cached viewing 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

-P Master origin/Mastergit merge Origin/master


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

Git pull Origin Master

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.