1. Cloning and Creating a Patch
$ git clone git://github.com/git/hello-world.git
$ cd hello-world
$ (edit files)
$ git add (files)
$ git commit -m 'Explain what I changed'
$ git format-patch origin/master
2. Creating and Commiting
$ cd (project-directory)
$ git init
$ (add some files)
$ git add .
$ git commit -m 'Initial commit'
Git_Server_Steps
1. Configuration:
git config --global user.name "username"
git config --global user.email "name@domain.com"
# 设置快捷方式
git config --global alias.ci commit
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.lo log --color
git config --global alias.sh show --color
1.获取代码树
$ git clone
2.创建自己的git库(empty)
$ mkdir $xxxDir
$ cd $xxxDir
$ git init
注:
1) git在当前目录中创建一个叫.git的子目录。
以后所有文件的变化信息都会保存到这个目录下,而不像CVS那样,会在每个目录和子目录下都创建一个CVS目录。
2) 在.git目录下有一个config文件,需要添加个人信息后才能使用,否则我们不能对其中添加和修改任何文件。
原始的config文件:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
加入
[user]
name = xxx
emai= xxx@kuxun.cn
usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]
[-p|--paginate|--no-pager] [--no-replace-objects]
[--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
[-c name=value
[--help] COMMAND [ARGS]
Commands:
init Create an empty git repository or reinitialize an existing one
add Add file contents to the index
bisect Find by binary search the change that introduced a bug
branch List, create, or delete branches
checkout Checkout a branch or paths to the working tree
clone Clone a repository into a new directory
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
fetch Download objects and refs from another repository
grep Print lines matching a pattern
log Show commit logs
merge Join two or more development histories together
mv Move or rename a file, a directory, or a symlink
pull Fetch from and merge with another repository or a local branch
push Update remote refs along with associated objects
rebase Forward-port local commits to the updated upstream head
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index
show Show various types of objects
status Show the working tree status
tag Create, list, delete or verify a tag object signed with GPG
阅读(1417) | 评论(0) | 转发(0) |