FANDOM


doc Edit

gitlab create new project Edit

  • git global setup
git config --global user.name "Yufei Ren"
git config --global user.email "yufei.ren@thomsonreuters.com"

check git config Edit

git config --list

ssh-keygen Edit

>ssh-keygen -t rsa -C "email@address"

git change origin url Edit

git remote set-url origin new_git_url

For ssh protocol (eg: git@github.com:ReutersMedia/logprocnode.git)Edit

Add below two lines to your ~/.ssh/config

HOST github.com
   ProxyCommand ssh distuser@10.90.39.170 "nc %h %p"

For http,https protocol (eg: https://github.com/mochi/mochiweb.git)Edit

Run below command to add corresponding configs to ~/.gitconfig.

$ git config --global http.proxy http://10.90.7.56:3128/

For git protocol (eg: git://github.com/mochi/mochiweb.git)Edit

Create /usr/local/bin/gitproxy.cmd with below content:

#!/bin/sh
ssh distuser@10.90.39.170 "nc $1 $2"

And make it executable:

$ sudo chmod a+x /usr/local/bin/gitproxy.cmd

Then run below command to add corresponding configs to ~/.gitconfig.

$ git config --global core.gitproxy /usr/local/bin/gitproxy.cmd

find in which tag Edit

>git describe --tags
>git describe --all

git tutorials Edit

git revert change Edit

git reset --hard
  • revert code to previous commit
git checkout rev_no .

git submodule Edit

GitHub Edit

github synchronize a fork Edit

eg:

>git clone git@github.com:yren/DiscoverMeteor_zh.git
>cd DiscoverMeteor_zh
lokvins-MBP:DiscoverMeteor_zh lokvin$ git remote -v
origin	git@github.com:yren/DiscoverMeteor_zh.git (fetch)
origin	git@github.com:yren/DiscoverMeteor_zh.git (push)
>git remote add upstream git@github.com:DiscoverMeteor/DiscoverMeteor_zh.git
>git fetch upstream
>git checkout master
>git merge
>git merge upstream/master

github pagesEdit

git branch Edit

  • set upstream branch
git branch -u origin/master master 
  • update remote branch
git remote update --prune
  • create a new branch
git branch new_branch_name
  • git checkout -b branch
git checkout -b new_branch_name
# create branch ckb-1 base on origin/ckb-1
git checkout -b ckb-1 origin/ckb-1 

equals

git branch new_branch_name
git checkout new_branch_name
  • git branch -r

list remote branch

 $ git branch -r
 origin/CKB-11783
 origin/CKB-11837
 origin/HEAD -> origin/master
 origin/betausS3
 origin/dbchanges
 origin/master
 origin/sampleBETAUSconfig
  • git branch -l [--list]

list local branch

  • delete remote branch
## after git v.1.7
git push origin --delete <branchName>
## before v1.7
git push origin :<branchName>
  • git branch -l
* master

untrack file Edit

  • add file to .gitignore
  • git rm --cached
git rm --cached .project
  • or use
 git update-index --assume-unchanged [path]
 git update-index --no-assume-unchanged [path]

git log graph Edit

git log --graph --all --oneline

git rebase Edit

git rebase -i master
## clean local commit 
git rebase -i ^head
## Do not do rebase on public branch

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.