[] Git git backup

Creative Commons License Copyright: Attribution, allow others to create paper-based, and must distribute paper (based on the original license agreement with the same license Creative Commons )

Transfer Protocol

Here Insert Picture Description
There are two local transmission protocol is protocol dumb one is intelligent protocol
intuitive difference: dumb protocol transfer progress is not visible; intelligent transmission protocol visible.
Transmission speed: intelligent protocol is faster than the dumb protocol transfer speed.

It is easy to see intelligent protocol more in line with our needs

Team development, then need remote code hosting platform - GitHub or GitLab

Git features local backup to the remote
Here Insert Picture Description
is easy to see which is the distributed nature of the differences and where one of svn

The git repository backup to the local

Cloned directly using the distal end of the warehouse (depot without bare work area) over the backup

Use backup dumb protocol

Use the following command:

git clone --bare /path/to/.git ya.git

The above command /path/to/.git git repository is the path of the backup file to the local ya.git

Bare warehouse parameters --bare means that without the work area

Here Insert Picture Description

Using Smart Backup agreement

Use the following command:

git clone --bare file:///path/to/.git ya.git zhineng.git

Here Insert Picture Description
Bring front git repository file: // prefix is ​​the use of intelligent transmission protocol, transmission time progress bar

After the distal end of the new warehouse

git remote add zhineng file:///d/Documents/666-backup/zhineng.git/

When the local warehouse new branch, while the distal not added to it, direct push
Here Insert Picture Description
Here Insert Picture Description

git push zhineng

Here Insert Picture Description
Tip of the above means that the use of a new branch locally git, you need to do associated with the remote branch. If there is no association, git will prompt you to add the associated display in the following operations.
When the association is aimed at the implementation of git pull, you do not need to specify when the corresponding remote branch git push operation, as long as you do not show specified, git pull, it will prompt you

View remote branch has been found over a push
Here Insert Picture Description


Associated with the remote warehouse occur
frequently used commands

$ git remote -v
# 查看关联的远端
    
$ git remote add <name> file://<path(.git)>
# 与指定远端仓库发生关联
    
$ git push 
# 按实际情况的提示继续 push 的操作
# 把本地的 commited 的文件,同步到远端仓库

Guess you like

Origin blog.csdn.net/qq_42322103/article/details/95206028
Git