Source Control--git (distributed versioning vs. centralized versioning, git vs. svn, git common commands, build GitHub remote repositories, build Oschina remote repositories)

Source: Internet
Author: User
Tags mac ssh key using git git clone repository

One, git introduction what is git? Git is an open source Distributed version Control tool in all of the world's distributed version control tools, Git is the fastest, simplest, and most popular git origin author is the father of Linux: Linus Benedict Torvalds developed git just to assist with the development of the Linux kernel (manage source code) the status quo of git is very popular abroad, and it is not popular in China (in the gradual popularization)

More and more open source projects have been moved to Git

CVS's earliest open source, free centralized version control tool has its own design problems, resulting in incomplete submissions, the repository inexplicably corrupted, SVN fixes some of the CVS stability issues, is currently the most used centralized repository control tool ClearCase charging centralized version control tool, Installation is larger than Windows, running slower than a snail can use ClearCase is generally the world's top 500, they have a common feature is deep-pocketed or people silly money more VSS Microsoft's centralized version control tool, integrated in Visual Studio II, Distributed versioning and centralized version control Centralized version control Distributed version Control Three Git and SVN 1. Simple comparison of Git and SVN Speed in many cases, git is much faster than SVN fast-structure SVN is centralized management, GIT is distributed to manage other SVN using branches rather clumsy, git can easily have unlimited branches svn must be networked to work properly, GIT supports local version control work older versions of SVN will have one in each directory. Svn,git will only have one. git 2 in the root directory, SVN's Workflow 3. Git's workflow The biggest difference between distributed and centralized is that under distributed developers can submit a database of servers on each developer's machine. Using Git 1. Using Git, like SVN, you can use git with command-line or GUI-interface clients

On Mac, the more useful git graphical interface client has sourcetree:http://www.sourcetreeapp.com/download/github:https:// Mac.github.com but it is specifically designed for the GitHub site, Xcode 2, Common git directives git help:git Instructions Help manual View other instructions: git helps other instructions

Git config:git configuration information (modified by. git/config file) Configure user name: Git config "user.name" username (for tracking change record) Configure mailbox: Git config "User.email" e-mail (for multi-person development communication) View configuration information: Git config–l edit configuration information: Git config–e (with VIM Editor: Wq is exit vim editor) set instruction alias: git config alias. The original instruction name is set with the alias of the parameter directive: Git config alias. The alias "original directive name parameter" applies this setting to the entire system: Git config––gloabal git status: Check the status of a file to see the status of a file: Git status file Name to view the status of all files in the current path: Git status

git log: View the modified log of a file to see the change log for a file: Git log file name to view the modification log of all files in the current path: git log view simple log information in one line: git log––pretty=oneline View recent n changes: git Log–n (N is an integer) git diff: View the most recent changes to a file where you see the latest changes to a file: Git diff file name to see where all the files in the current path have changed: Git diff git init: initializing an empty local repository, Generate a. Git directory for maintaining version information in the current path to initialize the repository: Git init in other paths initialize the repository: git init repository path git add: Save workspace file to hold zone save a file to a pending area: Git add File name saves all files of the current path to the pending area: Git Add. (Note that the last is a point.) Git commit: Commit a file to the current branch to commit a file to the branch: git commit-m "comment" file name saves all files of the current path to the branch: git commit-m "comment" git Reset: Version fallback (recommended plus ––hard parameter , Git supports unlimited regrets) fallback to previous version: Git Reset––hard head^ fallback to the last version: Git reset––hard head^^ fallback to top n versions: Git reset––hard head~ N (n is an integer) fall back to any version: Git reset––hard version number (version number with 7 bit) git reflog: View instruction usage record (ability to view all version numbers) git rm: Delete files (commit after deleting To sync to the repository) git clone: Download remote repository to local download remote repository to current path: URL of git clone repository download remote repository to specific path: URL of git clone repository repository path

Git pull: Download the latest information from the remote repository to the local repository git push: Push local repository information to remote Warehouse v. How it works if you want to understand how git works, there are several core concepts that you must know about the workspace (working Directory): Content other than the. git directory in the Warehouse folder Repository (Repository):. Git directory for storing record version information hold (stage) branch (master): Git automatically creates the first branch head pointer: The git add that points to the current branch and git commit git add : Add files or add files to staging area git commit: submit all contents of staging area to the current branch six, remote warehouse if the multi-person team developed, it is best to build a remote warehouse The way to build a remote warehouse build a git server yourself: time-consuming and laborious to host projects on GitHub: Public projects free, private project fees, many third-party open-source projects are hosted on Oschina: Totally free, fast in the country (recommended) Vii. Building GitHub Remote Repository 1. Configure SSH Key Sign up for a GitHub account: Https://github.com Open "Accounts settings click" SSH Keys "to configure the public key of the Mac SSH key (to limit the commit) view SSH version $ ssh–v open Terminal, $ Ssh-keygen all the way to enter. Generate SSH key on Mac (enter the command below) CD ~/.sshssh-keygen-t rsa-c "Your email address" and then go straight to the ~/.ssh directory to generate SSK Key's key pair Id_rsa: Private key, non-leaking id_ Rsa.pub: Public key, which can be exposed (pasting the contents of this file onto GitHub) using cat instructions to view the contents of a file Cat Id_rsa.pub 2, Add Warehouse Copy warehouse address, for download to local if you want to delete the warehouse, it is also very simple eight, Build Oschina Remote Warehouse 1. Create a warehouse Register a Oschina account: Https://git.oschina.net Warehouse Address Add Project group members

Then you need to set up Git's mailbox and user name at the terminal, or you won't have access to the repository.

2. Delete Warehouse

Source Control--git (distributed versioning vs. centralized versioning, git vs. svn, git common commands, build GitHub remote repositories, build Oschina remote repositories)

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.