git:建立映射到远程分支的本地分支

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了git:建立映射到远程分支的本地分支相关的知识,希望对你有一定的参考价值。

git:建立映射到远程分支的本地分支

git:建立映射到远程分支的本地分支

#TITLE: git:建立映射到远程分支的本地分支 #KEYWORDS: git,远程分支,本地分支,git config #DATE:

1 git初始化

aidongshengdeMacBook-Pro:openvpn aidongsheng$ git init
Initialized empty Git repository in /Users/aidongsheng/project/openvpn/.git/

2 git config (配置)

aidongshengdeMacBook-Pro:openvpn aidongsheng$ git config user.name "aidongsheng" 
aidongshengdeMacBook-Pro:openvpn aidongsheng$ git config user.email "[email protected]"
aidongshengdeMacBook-Pro:openvpn aidongsheng$ git remote add origin https://github.com/OpenVPN/openvpn.git
aidongshengdeMacBook-Pro:openvpn aidongsheng$ git config -l
core.excludesfile=~/.gitignore
core.legacyheaders=false
core.quotepath=false
core.pager=less -r
mergetool.keepbackup=true
push.default=simple
color.ui=auto
color.interactive=auto
repack.usedeltabaseoffset=true
alias.s=status
alias.a=!git add . && git status
alias.au=!git add -u . && git status
alias.aa=!git add . && git add -u . && git status
alias.c=commit
alias.cm=commit -m
alias.ca=commit --amend
alias.ac=!git add . && git commit
alias.acm=!git add . && git commit -m
alias.l=log --graph --all --pretty=format:‘%C(yellow)%h%C(cyan)%d%Creset %s %C(white)- %an, %ar%Creset‘
alias.ll=log --stat --abbrev-commit
alias.lg=log --color --graph --pretty=format:‘%C(bold white)%h%Creset -%C(bold green)%d%Creset %s %C(bold green)(%cr)%Creset %C(bold blue)<%an>%Creset‘ --abbrev-commit --date=relative
alias.llg=log --color --graph --pretty=format:‘%C(bold white)%H %d%Creset%n%s%n%+b%C(bold blue)%an <%ae>%Creset %C(bold green)%cr (%ci)‘ --abbrev-commit
alias.d=diff
alias.master=checkout master
alias.spull=svn rebase
alias.spush=svn dcommit
alias.alias=!git config --list | grep ‘alias\.‘ | sed ‘s/alias\.\([^=]*\)=\(.*\)/\1\     => \2/‘ | sort
include.path=~/.gitcinclude
include.path=.githubconfig
include.path=.gitcredential
diff.exif.textconv=exif
credential.helper=osxkeychain
user.name=aidongsheng
[email protected]
push.default=matching
core.editor=/usr/bin/emacs
core.excludesfile=/Users/aidongsheng/.gitignore_global
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
user.name=aidongsheng
[email protected]
remote.origin.url=https://github.com/OpenVPN/openvpn.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*

3 git clone (克隆)

aidongshengdeMacBook-Pro:openvpn aidongsheng$ git clone https://github.com/OpenVPN/openvpn.git
Cloning into ‘openvpn‘...
remote: Counting objects: 13972, done.
remote: Total 13972 (delta 0), reused 0 (delta 0), pack-reused 13972
Receiving objects: 100% (13972/13972), 10.66 MiB | 154.00 KiB/s, done.
Resolving deltas: 100% (10145/10145), done.
Checking connectivity... done.

4 获取远程分支 (branch) 以及标签 (tag)

  aidongshengdeMacBook-Pro:openvpn aidongsheng$ git fetch    /* 获取远程分支以及标签信息 */
remote: Counting objects: 13575, done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 13575 (delta 2), reused 25 (delta 2), pack-reused 13550
Receiving objects: 100% (13575/13575), 10.58 MiB | 303.00 KiB/s, done.
Resolving deltas: 100% (9830/9830), done.
From https://github.com/OpenVPN/openvpn
 * [new branch]      beta/2.3   -> origin/beta/2.3
 * [new branch]      coverity_scan -> origin/coverity_scan
 * [new branch]      master     -> origin/master
 * [new branch]      release/2.1 -> origin/release/2.1
 * [new branch]      release/2.2 -> origin/release/2.2
 * [new branch]      release/2.3 -> origin/release/2.3
 * [new tag]         v2.2.3     -> v2.2.3
 * [new tag]         v2.3.0     -> v2.3.0
 * [new tag]         v2.1.0     -> v2.1.0
 * [new tag]         v2.1.1     -> v2.1.1
 * [new tag]         v2.1.2     -> v2.1.2
 * [new tag]         v2.1.3     -> v2.1.3
 * [new tag]         v2.1.4     -> v2.1.4
 * [new tag]         v2.1_rc1   -> v2.1_rc1
 * [new tag]         v2.1_rc10  -> v2.1_rc10
 * [new tag]         v2.1_rc11  -> v2.1_rc11
 * [new tag]         v2.1_rc12  -> v2.1_rc12
 * [new tag]         v2.1_rc13  -> v2.1_rc13
 * [new tag]         v2.1_rc14  -> v2.1_rc14
 * [new tag]         v2.1_rc15  -> v2.1_rc15
 * [new tag]         v2.1_rc16  -> v2.1_rc16
 * [new tag]         v2.1_rc17  -> v2.1_rc17
 * [new tag]         v2.1_rc18  -> v2.1_rc18
 * [new tag]         v2.1_rc19  -> v2.1_rc19
 * [new tag]         v2.1_rc2   -> v2.1_rc2
 * [new tag]         v2.1_rc20  -> v2.1_rc20
 * [new tag]         v2.1_rc21  -> v2.1_rc21
 * [new tag]         v2.1_rc22  -> v2.1_rc22
 * [new tag]         v2.1_rc3   -> v2.1_rc3
 * [new tag]         v2.1_rc4   -> v2.1_rc4
 * [new tag]         v2.1_rc5   -> v2.1_rc5
 * [new tag]         v2.1_rc6   -> v2.1_rc6
 * [new tag]         v2.1_rc7   -> v2.1_rc7
 * [new tag]         v2.1_rc8   -> v2.1_rc8
 * [new tag]         v2.1_rc9   -> v2.1_rc9
 * [new tag]         v2.2-RC    -> v2.2-RC
 * [new tag]         v2.2-RC2   -> v2.2-RC2
 * [new tag]         v2.2-beta4 -> v2.2-beta4
 * [new tag]         v2.2-beta5 -> v2.2-beta5
 * [new tag]         v2.2.0     -> v2.2.0
 * [new tag]         v2.2.1     -> v2.2.1
 * [new tag]         v2.2.2     -> v2.2.2
 * [new tag]         v2.3-alpha1 -> v2.3-alpha1
 * [new tag]         v2.3.1     -> v2.3.1
 * [new tag]         v2.3.10    -> v2.3.10
 * [new tag]         v2.3.11    -> v2.3.11
 * [new tag]         v2.3.2     -> v2.3.2
 * [new tag]         v2.3.3     -> v2.3.3
 * [new tag]         v2.3.4     -> v2.3.4
 * [new tag]         v2.3.5     -> v2.3.5
 * [new tag]         v2.3.6     -> v2.3.6
 * [new tag]         v2.3.7     -> v2.3.7
 * [new tag]         v2.3.8     -> v2.3.8
 * [new tag]         v2.3.9     -> v2.3.9
 * [new tag]         v2.3_alpha2 -> v2.3_alpha2
 * [new tag]         v2.3_alpha3 -> v2.3_alpha3
 * [new tag]         v2.3_beta1 -> v2.3_beta1
 * [new tag]         v2.3_rc1   -> v2.3_rc1
 * [new tag]         v2.3_rc2   -> v2.3_rc2
aidongshengdeMacBook-Pro:openvpn aidongsheng$ git branch -r


  origin/beta/2.3
  origin/coverity_scan
  origin/master
  origin/release/2.1
  origin/release/2.2
  origin/release/2.3

Author: aidongsheng

Created: 2016-06-28 Tue 11:38

Emacs 24.5.1 (Org mode 8.2.10)

Validate

以上是关于git:建立映射到远程分支的本地分支的主要内容,如果未能解决你的问题,请参考以下文章

git拉取远程分支到本地(VScode)

git拉取远程分支并创建本地分支

git建立本地分支和远程分支

GitGit 分支管理 ( 克隆远程分支 | 克隆 master 分支 git clone | 查看远程分支 git branch -a | 克隆远程分支 git checkout -b )(代码片段

GitGit 分支管理 ( 克隆远程分支 | 克隆 master 分支 git clone | 查看远程分支 git branch -a | 克隆远程分支 git checkout -b )(代码片段

git远程分支代码拉取