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