Quick Start for Git Installation and Use under Ubuntu 14.04

Git is the most advanced distributed version control system in the world. GitHub is a website that uses Git to host code.
(Keywords: repository: repository, also known as warehouse)

Git installation:
Method 1: Download Git source code, compile and install
https://github.com/git/git  
     Optional method for downloading source code: git clone https://github. com/git/git
     1. Check out all versions in history (the latest version is checked out by default): git tag
     2. Select the version to check out: git checkout v1.7.8.2 (example) 
sudo apt-get install openssl
sudo apt-get install libssl-dev build-essential zlibc zlib-bin libidn11-dev libidn11
sudo apt-get install libcurl4-gnutls-dev
sudo apt-get install libexpat1-dev
make prefix=/usr/local all
sudo make prefix =/usr/local install
Method 2: Install
sudo apt-get update from the source to obtain a list of recent packages;
sudo apt-get install git

Test whether the installation is successful: git --version

Basic configuration of
Git git config --global user.name "Your Name Here"
git config --global user.email [email protected]
View existing configuration information: git config --list

Git use
(1) Initialization: Create a new folder (git_project), cd into it, create a code repository 
git init
Enter the folder, show the file hidden and visible (ls -a), and a .git file
will be generated in it. Put the project (LiteNES) that needs to be managed into the file Under the folder git_project
git status
git add LiteNES
git commit -m "init the project"

(2) Modify the file and restore it:
open the file LiteNES/src/main.c Edit and modify
cd LiteNES
git add ./src/main.c
git commit - m "add code comment"
git log
git show dcf7c11e403f7e4ff129aab01e6b6962e1120a77
git revert dcf7c11e403f7e4ff129aab01e6b6962e1120a77
(vim) wq! Save and exit to restore the state before modification.

References: [1][Original] Quick Start for GitHub Installation and Use under Ubuntu 12.04 (Updating): https://git-scm.com/book/zh/v1
                    [2]Git Chinese Documentation: https://git -scm.com/book/en/v1/%E8%B5%B7%E6%AD%A5

                    [3] Use Git to manage local projects: http://www.linuxidc.com/Linux/2014-03/98367.htm

                    https://github.com/purpleroc/rdial

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325178168&siteId=291194637