Git Basics
Git Commands
git clone
git pull
--rebase: Instead of a merge, perform a rebase after fetching.
git push
git remote
-v, --verbose
set-url <name> <url>
git log
git diff
git tag
-a <tagname> <commit>
git describe
git status
git-rev-parse
git add
git rm
git mv
git reset
git revert
git commit
--ammend*
Git 版本控制系統(3) 還沒 push 前可以做的事
git branch
branch: create a new branch.
-d branch: Delete a branch. The branch must be fully merged in HEAD.
-D branch: Delete a branch irrespective of its merged status.
git checkout
branch: switch to branch
path: discard changes on working copy
git merge
git rebase
branch: Forward-port local commits base on the branch.
Git 分支 - 分支的新建與合併
Git Branch 的操作與基本工作流程
使用 git rebase 避免無謂的 merge
Pull with rebase
2015年4月21日 星期二
2015年4月14日 星期二
Github Usage
Change the repository URL of local working copy:
View the current origin URL: $ git remote -v
$ git remote set-url origin https://github.com/<user>/<repo>.git
If you try to access the repository (clone, push, ...etc) via HTTP/HTTPS, the following error occurred:
error: The requested URL returned error: 403 while accessing https://github.com/user/repo.git/info/refsUse SSH (get the URL from the repository):
fatal: HTTP request failed
$ git remote set-url origin git@github.com:<user>/<repo>.git
Connecting over SSH
If you clone with SSH, you must generate SSH keys on each computer you use to push or pull from GitHub.
Note: you can use the ~/.ssh/config to setup the SSH authentication instead of ssh-agent
Template of .gitignore
https://github.com/github/gitignore
Reference:
https://help.github.com/set-up-git-redirect
https://help.github.com/create-a-repo
https://help.github.com/articles/fork-a-repo/
https://help.github.com/articles/https-cloning-errors/
https://help.ubuntu.com/lts/serverguide/git.html
Subversion Command
Checkout:
svn co URL[@REV]... [PATH]
Commit:
svn ci [PATH]
--depth ARG : limit operation by depth ARG ('empty', 'files',
'immediates', or 'infinity')
Log:
svn log [PATH][@REV]
URL[@REV] [PATH...]
-r ARG1[:ARG2] :
NUMBER: revision number
{DATE}: revision at start of the date, ex: {2015-01-01}
HEAD: latest in repository
BASE: base rev of item's working copy
COMMITTED: last commit at or before BASE
PREV: revision just before COMMITTED
Difference:
svn diff [-r ARG1[:ARG2]]
Merge:
Roll back to the old version:
$ svn up
$ svn merge -rHEAD:{NUMBER} [PATH]
$ svn ci
Edit Property:
svn pe svn:externals .
Note: svn recognizes the following special versioned properties
svn:ignore - A newline separated list of file glob patterns to ignore.
svn:keywords - Keywords to be expanded.
svn:executable - If present, make the file executable.
svn:eol-style - One of 'native', 'LF', 'CR', 'CRLF'.
svn:mime-type - The mimetype of the file.
svn:externals - A newline separated list of module specifiers, each of which consists of a URL and a relative directory path.
svn:needs-lock - If present, indicates that the file should be locked before it is modified.
svn co URL[@REV]... [PATH]
Commit:
svn ci [PATH]
--depth ARG : limit operation by depth ARG ('empty', 'files',
'immediates', or 'infinity')
Log:
svn log [PATH][@REV]
URL[@REV] [PATH...]
-r ARG1[:ARG2] :
NUMBER: revision number
{DATE}: revision at start of the date, ex: {2015-01-01}
HEAD: latest in repository
BASE: base rev of item's working copy
COMMITTED: last commit at or before BASE
PREV: revision just before COMMITTED
Difference:
svn diff [-r ARG1[:ARG2]]
Merge:
Roll back to the old version:
$ svn up
$ svn merge -rHEAD:{NUMBER} [PATH]
$ svn ci
Edit Property:
svn pe svn:externals .
Note: svn recognizes the following special versioned properties
svn:ignore - A newline separated list of file glob patterns to ignore.
svn:keywords - Keywords to be expanded.
svn:executable - If present, make the file executable.
svn:eol-style - One of 'native', 'LF', 'CR', 'CRLF'.
svn:mime-type - The mimetype of the file.
svn:externals - A newline separated list of module specifiers, each of which consists of a URL and a relative directory path.
svn:needs-lock - If present, indicates that the file should be locked before it is modified.
訂閱:
文章 (Atom)