The Go Blog

Git Flow Workflow

bantana
10 May 2015

git工作模型

pi2 repos remote on raspberry pi2
bantana mac client
sspi raspberry pi2 client

在pi2上初始化主repos

ssh pi@10.10.0.9 git init --bare /home/pi/repos/myarticles.git

user bantana clone the pi2 repos hello.git on mac client clone the pi2 master repos to local repository

git clone pi@10.10.0.9:/home/pi/repos/myarticles.git

fix push

cd mynotes
git push origin master
git push

git push <REMOTENAME> <LOCALBRANCHNAME>:<REMOTEBRANCHNAME>

default <REMOTENAME> is origin

$ git r
origin  mygo:/home/pi/repos/myarticles.git (fetch)
origin  mygo:/home/pi/repos/myarticles.git (push)

$ git remote add aozsky aozsky:/home/bantana/repos/myarticle.git
$ git r
aozsky  aozsky:/home/bantana/repos/myarticles.git (fetch)
aozsky  aozsky:/home/bantana/repos/myarticles.git (push)
origin  mygo:/home/pi/repos/myarticles.git (fetch)
origin  mygo:/home/pi/repos/myarticles.git (push)

first:

$ git push aozsky master:master

laster:

$ git push aozsky

my tip

my ~/.gitconfig

[alias]
  s = status
  b = branch -v
  r = remote -v
  t = tag -l
  g = grep --break --heading --line-number
  d = difftool
  c = commit -v
  co = checkout
  lg = log --graph --pretty=format:'%Cred%h%Creset %C(yellow)%an%d%Creset %s %Cgreen(%cr)%Creset' --date=relative
  pb = "!git push origin \"$(git rev-parse --abbrev-ref HEAD)\""
  db = "!git push origin :\"$(git rev-parse --abbrev-ref HEAD)\""
  pbf = "!git push -f origin \"$(git rev-parse --abbrev-ref HEAD)\""
  up = "!git pull --rebase origin \"$(git rev-parse --abbrev-ref HEAD)\""
  pr = "pull-request"
  hub = "browse --"
  i = "issue"
  ic = "issue create"
  cis = "ci-status"
  mt = !sh -c '_CURRENT_BRANCH=$(git symbolic-ref --short HEAD) && git checkout $1 && git merge $_CURRENT_BRANCH && git checkout $_CURRENT_BRANCH' -
  dev = "!git checkout develop"
  master = "!git checkout master"

don't working on the master.

master only user to merge, push, pull. Do not do other matters in this branch. Do not do from master merge to other branch.

switch develop

git dev

switch master

git master

push current branch to remote same branch

git pb

delete remote branch with local branch name

git db

✔ ~/repos/myarticles [develop L|✔]
00:21 $ git branch -a
* develop
  master
  remotes/origin/master
✔ ~/repos/myarticles [develop L|✔]
00:21 $ git pb
Total 0 (delta 0), reused 0 (delta 0)
To pi@10.10.0.9:/home/pi/repos/myarticles.git
 * [new branch]      develop -> develop
✔ ~/repos/myarticles [develop L|✔]
00:21 $ git branch -a
* develop
  master
  remotes/origin/develop
  remotes/origin/master
✔ ~/repos/myarticles [develop L|✔]
00:21 $ git db
To pi@10.10.0.9:/home/pi/repos/myarticles.git
 - [deleted]         develop
✔ ~/repos/myarticles [develop L|✔]
00:22 $ git branch -a
* develop
  master
  remotes/origin/master
✔ ~/repos/myarticles [develop L|✔]

Related articles