Git Base for Linux

Source: Internet
Author: User
Tags diff git clone

GitHub Combat Series Summary: Http://www.cnblogs.com/dunitian/p/5038719.html

abbreviation code: Https://www.cnblogs.com/dotnetcrazy/p/9162115.html#code

Linux install git, make a record ( use the privacy mailbox provided by GitHub )

# git official manual Https://git-scm.com/book/zh/v2

# 1. Install git
sudo apt-get install git

# 2. Set the user name and mailbox ( Use the privacy mailbox provided by GitHub )
git config--global user.name "Your name"
git config--global user.email xxx+ name @users.noreply.github.com

git config--list #查看所有配置

# 3. Cloning an existing Git repository (supports multiple link protocols)

git clone https://github.com/lotapp/BaseCode.git

# 4. Check the current file status
git status #随时可以查状态


# 5. This time you add files are not tracked (if this file does not exist before, then can not be traced)
Cp-r python/basecode/


# 6. Add a Trace file
git add xxx

# 7. Check the current file status
git status #现在已被跟踪 and in a staged state


# 8. Submit an Update
Git commit-m "Memo info"


# 9.1 Modifying files
# to see which parts of a file that have not yet been staged updated (vs. historical versions)
git diff modified files

# After the general is the modified file, git add a bit (add changes are this command)
#git其实提供了一个便捷的方法 git commit-a-M "xxx"
git commit -A-M "test skip git Add"

# 9.2 Delete Files as you can use Git commit-a-M "xxx" to quickly submit
git commit -a-m "test skip git Add"


# 10. Push to remote end
git push #默认是git pull Origin master, others need to specify ( modified origin can also use git push to push to clone the remote repository by default )

About viewing the extension of a history submission: (often used when in conflict)

# View History Submissions
git log

# The common option is- p, which shows the difference in content for each commit
git log-p-2 #查看最近两次提交

# Brief statistics per submission (scenario: A quick tour of the changes brought about by a small partner commit)
git log--stat
git log--stat-p-2 #可以联合使用

The--STAT option lists all modified files under each commit, how many files have been modified, and which rows of the modified files have been removed or added. At the end of each submission there is a summary

--------------------------------------------------------------------
extension (Conflict detection fine): git log--pretty=format eg: (--graph is beautify output )
git log--pretty=oneline--graph #一行显示, more convenient when the volume of data is large
git log--pretty=format: "%h-%an,%ar:%s" #时间显示

Abbreviated Code:

--------------------------------------------------# 1. Install gitsudoApt-getInstallgit-----------------------# 2. Set user name and mailbox git config--global User.Name"Your Name"git config--global User.email xxx+Name @users.noreply.github.comgit config--List #查看所有配置-----------------------# 3. Clone an existing git repository git clone https://Github.com/lotapp/basecode.git-----------------------# 4. Check the current file status git status #随时可以查状态-----------------------# 5This time you add files that are not tracked (if this file doesn't exist before, then you can't track it)CP-R python/basecode/-----------------------# 6. Add trace file git add xxx-----------------------# 7Check the current file status git status #现在已被跟踪 and in a staged state-----------------------# 8. Commit update git commit-M"Notes Information"-----------------------# 9. 1 Modifying a file # to see which parts of a file have not yet been staged updated (vs. historical versions) Gitdiffmodified file # is usually the first to put the modified file, git add (this is the command to add the changes) #git其实提供了一个便捷的方法 git commit-a-m"XXX"git commit-a-m"test Skip git add"# 9.2 Delete Files as you can with Git commit-a-m"XXX"to quickly commit a git commit-a-m"test Skip git add"-----------------------# Ten. Push to the remote end (if multiple remote warehouses or write-all) git push #默认是origin master# if it's multiple remote repositories or suggests write-all:(modified origin can also be used with Git Push to the remote repository that was pushed to clone by default)Git push Origin master-----------------------# View History commit git log# common options are-p, used to display the content of each commit difference git log-P-2#查看最近两次提交 # Brief statistics per submission (scenario: A quick tour of the changes brought about by a small partner commit) git log--Statgit log--Stat-P-2#可以联合使用--StatThe options listed below each commit are all modified files, how many files have been modified, and which rows of the modified files have been removed or added. At the end of each commit there is a summary extension (Conflict detection fine): git log--pretty=format eg: (--graph is beautify output) git log--pretty=oneline--graph #一行显示, more convenient git log when the data volume is large--pretty=format:"%h-%an,%ar:%s"#时间显示-------------------------------------------------------------

Git Base for Linux

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.