Git Compendium

The basic concept:
Warehouse (Repository):
warehouse means that your project, you want to open a project on GitHUb, it is necessary to rebuild a
Repository, if you are more open-source project, you will have multiple Repository

Collection (Star)
Depot home star button, meaning the number of collection project on GitHub if you have a project to obtain
100 Star are considered very easy!

Copy cloning project (Fork)
If you really want me to translate it into translation bifurcation, it is that you open a project, the project you want others
to do to improve on the basis of, and references to their own projects, this time he could Fork your project
(project home page opens click on the button to the top right corner of the fork), then on his home page on GitHub more than a
project, but this project is based on your project basis, he would be arbitrary to improve, but
the slightest It will not affect the code structure of the original project.

Initiating a request (Pull Request)
initiated the request, this is in fact based, or that the above example Fork, if someone in your foundation
on the improvements have been made, but then I improved very good, should make these improvements so that more people benefit , so
you want to own improvements incorporated into the original project, this time he can initiate a request Pull
(referred to as PR), who created the original project, that is, you can receive this request, this time you will carefully
review his code, test and feel ok, it will accept his PR, this time he made improvements,
the original project would have come.

Watch (Watch)
This understanding is to observe Ye Hao, if you watch an item, then later as long as the items have any
updates, you will be notified first time on this project reminder

Transaction Card (lssue)
have found that BUG, but there is no molding codes need to be discussed with,
the problem of meaning, for example, is that you open a striking, others find that your project has a bug,
or those places is not good enough he can give you a lssue, that is the problem, raise this issue more, is
lssues, then you see that these problems can go one by one to repair, the repair will be ok one by one
close out.

Home Github
account is successfully created or click Web site navigation bar github github icon can enter the home page, the home page
left side of the main display dynamic user and user attention or concern dynamic warehouse, the right side shows all git repository

Depot Home
Depot Home main display project information such as project code, version, collections / attention / fork and other circumstances

Profile
personal information, avatars, personal profiles, and people following me, people I am concerned, I am concerned about the git repository, my
open-source projects, I contribute to open source projects and other information

Git
using git purpose: Managed by git github project code management
official website: www.git-scm.com/download/win

Git work areas:
a work area (Working Directory): add, edit, modify files operation

暂存区:暂存已经修改的文件最后统一提交到git仓库中

Git Repository(Git创库) :最终确定的文件保存到创库,
						成为一个新的版本,并且对他人可见

命令:
	git status --> git add +文件名 --> git status --> 
	git  commit -m "提交描述" -->git status	

Git initialization and warehouses to create and manipulate
basic settings:
1. Set Username: git config --global user.name 'user name'
2. Set the user name E-mail: git config --global user.email 'mail user name'

Initialize a new Git repository
1. Create a folder
2. Initialize the git in a file (created git repository)
command: git init (it contains all the information stored in the local repository)
Touch + file name: that to create the file

The code will be submitted to the local repository to the remote repository
git push: the local repository will be submitted to a remote repository
thinking: Why can not sync sometimes have code hints:? 1 do not have permission 2.The Request url returned erro: 403 Forbidden while accessing
there when a cache problem, this time to modify the config file in the git directory
will [Remote 'Origin']
url = https://github.com/ username / warehouse .git name
changed to:
[Remote 'Origin']
url = http: // username: password @ github.com / username / warehouse name .git

Git clone
remote repository (GitHub corresponding item) to a local repository
the code: git clone + repository address

Github Pages website set up
a personal site
visit
http: // username .github.io

Build step
1) Create Personal Site -> New Warehouse (Note: The name must be a warehouse [ username .github.io ])
2) new index.html file in the repository can

Local Warehouse:
Git Code:
git Status: This command allows us to always grasp the current state of the repository
git diff: This command can view the contents of the revised
git add + "filename": Indicates Add Files
commit -m "description git content: increased features ": denotes submitted to the local repository
git log: this command to display the commit log from the nearest to the furthest ( 'state of all modifications which includes a version number')
Git = log --pretty oneline
Git the reflog is: each of the recording command a command
git checkout - 'filename': 1 if fileName file has not been modified since the staging area into the now revoked and the repository will return to exactly the same state
2. If the fileName file has been added to the staging after the area is now added to undo changes returned to the state after staging area
3. in short, it is to make the fileName file back to the last commit git status when the Add or git
git the Add:. said it would push all current files to the buffer zone

Key Code:
fall back to the previous version: git reset --hard HEAD ^
fall back on the version: git reset --hard HEAD ^^
goes back to 100 version: git reset --hard HEAD-100
will retreat specific version: git reset --hard specific version number

Remote repository: if the code needs to be submitted to the local repository remote repository: 1. Create SSK Key: black terminal input ssh-keygen -t rsa -C 'your own GitHub' registered email
records .shh directory location (/ c / Users /liulin/.ssh)

											输入GitHub注册密码(注意:密文输入,黑屏终端不会显示密码)
											.ssh  id_rsa:私钥
												  id_rsa.pub:公钥
											测试秘钥是否通过:ssh -T [email protected] 

Associated with the remote repository: git remote add origin + 'remote repository address'
remove the associated remote repository: git remote rm origin

Local repository submit to a remote warehouse processes:
1. Create a folder, the code will be submitted in the file on the desktop
2. Use the git init command initialization file (the purpose is to create a .git folder)
3. Use git add + ' filename '
4. git commit -m' descriptors' will be submitted to the local repository the code
5. ssh function allows the local repository and the remote repository establishing a connection
1> using ssh-keygen -t rsa -C 'own mailbox name' ( this command will finish in C: / Users / liulin / .ssh below generate a file name)
2> there are two files under the file .ssh id_rsa: private and id_rsa.pub: a public key
3> enter github-> settings- > SSH and GPG keys of public key cryptography was added
4> using git remote add origin 'ssh connected at their warehouse' (Note: this command is associated with the remote repository)
5> Important Note: If the establishment with the remote repository README. when the MD file, it must first be pulled from a remote repository local repository can only be done from the local repository to upload files to a remote warehouse operations behind
using git pull --rebase origin master the fifth step 6. the above documents will README.MD pulled local warehouse
7. Finally, the git push -u origin master command to upload local files to a remote warehouse warehouse

.gitignore: means to ignore files (files written on the inside of the names and suffixes)

Branch Management: 1 Role: Suppose you are ready to develop a new feature, but two weeks to complete, the first week of writing 50%, if submitted immediately,
because the code has not yet finished, incomplete code causes others can not do live, such as if all the code written submission once again
, a huge risk of losing a daily schedule will exist. With branch to avoid the above problem, create a branch of their own,
others can not see, but also continue to work on the original branch, and we work on their branches, I would like to submit submitted until
after the completion of the development once again merged into the original branch, so that safe and do not affect the work of others
2. features: git branch is different, whether to create, delete, and switching branch, git in a very short period of time
will be able to complete, regardless of the repository is a file or ten thousand files

	 master分支:在版本回退中,每次提交,git都会把它们串成一条时间线,在git里,这个分支叫主分支,即
	 master分支,HEAD严格来说不是指向提交,而是指向master,master才是指向提交的,所以,HEAD指向的就是
	 当前分支。

Creating a branch: Branch git branch name
and branch switching: git Checko
created simultaneously with the handover: git checkout -b branch name
merging branches: git Merge 'represents a combined branch name to git'
merging branches: NOTE To merge above the other branches in the main branch , git merge 'said to git merge branch name'
create a branch in the remote repository above: git push --set-upstream origin branch name

Delete branch: git branch -d branch name
to delete remote branch: git push origin: name of a branch
git push origin --delete branch name
git log --graph looking at branches merged graph

Branching strategy: master branch should be very stable, is still only used to release a new version, usually can not work above
work are on the dev branch, which is the dev branch is unstable, at some point, such as version 1.0 when,
then dev branch into the master, the master branch in the version 1.0 release,
you and your little friends and everyone working on the dev branch, everyone has their own branch, from time to time to the dev branch merger on the line

Label Management: Meaning: When you publish a version, we usually first hit in a repository label (tag), so that it uniquely identifies
the version of tagging time in the future no matter what, take a version of the label, it is to the tagging of
historical versions of time taken out, so the label is a snapshot version

	代码: git tag 标签名   :打标签
		  git tag  标签名 commitid   :指定commd id 打标签
		  git tag -a 标签名 -m '标签信息' :指定标签信息
		  git checkout 标签名   :切换到指定标签
		  git show 标签名  : 查看说明文字
		  git tag -d 标签名 : 删除标签
		  git push origin	: 推送标签到远程
		  git push origin --tags :一次性推送全部尚未推送到远程的本地标签
		  删除已经推送到远程的标签: 1.先从本地仓库删除   git tag -d  标签名
		  						   2. 再从远程仓库删除  git push origin :refs/tages/标签名
Published 13 original articles · won praise 3 · Views 4235

Guess you like

Origin blog.csdn.net/qq_43320461/article/details/88828904
Git