码迷,mamicode.com
首页 > 其他好文 > 详细

新随笔

时间:2016-06-27 17:12:01      阅读:302      评论:0      收藏:0      [点我收藏+]

标签:

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

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

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 "xxxxxxxxxxx@163.com"
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
user.email=xxxxxxxxxxx@163.com
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
user.email=xxxxxxxxxxx@163.com
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

5 建立远程分支与本地分支之间的映射

aidongshengdeMacBook-Pro:openvpn aidongsheng$ git branch --set-upstream master origin/master
The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to  /*--set-upstream已经重写为--set-upstream-to*/
Branch master set up to track remote branch master from origin.    /* 本地分支master被设置为追踪remote origin的master分支(主分支) */
aidongshengdeMacBook-Pro:openvpn aidongsheng$ git branch /* 查看当前仓库本地分支 */

#+BEGINSRC sh

6 master

#+ENDSRC

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-27 Mon 17:03

Emacs 24.5.1 (Org mode 8.2.10)

Validate

新随笔

标签:

原文地址:http://www.cnblogs.com/aidongsheng/p/5620423.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!