git workflow

1) fork map-matcher.git repo
2) add ssh-keygen public key to gitlab
3) clone repo
  git clone [email protected]:kezunlin/map-matcher.git
4) create branch proj2dist and add new files
  git checkout -b branch-proj2dist
  git add 1.txt
  git commit -m "add 1.txt"

5) push branch to remote branch
  git remote
  # origin
  git push origin branch-proj2dist:branch-proj2dist

6) update branch files
  git add 2.txt
  git commit -m "add 2.txt"
  git push origin branch-proj2dist:branch-proj2dist

 

#config

git config --global user.name "Bob"
git config --global user.email "[email protected]"

 

git config --global color.status auto
git config --global color.branch auto

git config --list

 

#list log

git log -5

git log --pretty=oneline --abbrev-commit

 

#list local branch

git branch

# list remote branch

git branch -r

# create new branch

git checkout -b new-branch origin/master

 

#update local branch from remote branch

git pull origin remote-branch:local-branch

#update remote branch from local branch

git push origin local-branch:remote-branch

 

#delete remote branch

git checkout xxx

git push origin :branch-test

git push origin --delete branch-test

 

#delete local branch

#for not merged branch

git checkout master

git branch -D branch-test

#for merged branch

git branch -d branch-test 
error: Cannot delete the branch 'branch-test' which you are currently on.

git checkout master

git branch -d branch-test

 

#merge branch test1 into master

git checkout master

git merge -m "merge test1 into master" test1

 

# tags

git tag -a v0.1 -m "version 0.1"

git tag -l

#push tag

git push origin refs/tags/v0.1

git pull origin refs/tags/v0.1

#push/fetch all tags

git push --tags

git fetch --tags

 

#delete local tag

git tag -d v0.1

#delete remote tag

git push origin :refs/tags/v0.1

git push origin --delete refs/tags/v0.1

 

git ls-remote  --heads --tags origin

你可能感兴趣的:(git workflow)