Skip to content

Commit

Permalink
add some git commands
Browse files Browse the repository at this point in the history
  • Loading branch information
lianghanquan committed Nov 25, 2015
1 parent 7d3e3f0 commit df2e5cc
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions shell实例手册.sh
Original file line number Diff line number Diff line change
Expand Up @@ -226,23 +226,29 @@
./configure --with-curl --with-expat
make
make install

git clone [email protected]:gittest.git ./gittest/ # 克隆项目到指定目录
git config [--global] user.name "your name" # 设置你的用户名, 希望在一个特定的项目中使用不同的用户或e-mail地址, 不要--global选项
git config [--global] user.email "your email" # 设置你的e-mail地址, 每次Git提交都会使用该信息
git config [--global] user.name # 查看用户名
git config [--global] user.email # 查看用户e-mail
git config --global --edit # 编辑~/.gitconfig(User-specific)配置文件, 值优先级高于/etc/gitconfig(System-wide)
git config --edit # 编辑.git/config(Repository specific)配置文件, 值优先级高于~/.gitconfig
git status # Show the working tree(工作树) status
git branch -a # 列出远程跟踪分支(remote-tracking branches)和本地分支
git checkout developing # 切换到developing分支
git pull # 更新项目 需要cd到项目目录中
git add . # 更新所有文件
git commit -m "gittest up" # 提交操作并添加备注
git push # 正式提交到远程git服务器
git push [-u origin master] # 正式提交到远程git服务器(master分支)
git tag [-a] dev-v-0.11.54 [-m 'fix #67'] # 创建tag,名为dev-v-0.11.54,备注fix #67
git tag -l dev-v-0.11.54 # 查看tag(dev-v-0.11.5)
git push origin --tags # 提交tag
git reset --hard # 本地恢复整个项目
git rm -r -n --cached ./img # -n执行命令时,不会删除任何文件,而是展示此命令要删除的文件列表预览
git rm -r --cached ./img # 执行删除命令 需要commit和push让远程生效
git init --bare smc-content-check.git # 初始化新git项目 需要手动创建此目录并给git用户权限 chown -R git:git smc-content-check.git
git config --global credential.helper store # 记住密码
git config [--global] user.name "your name" # 设置你的用户名, 希望在一个特定的项目中使用不同的用户或e-mail地址, 不要--global选项
git config [--global] user.email "your email" # 设置你的e-mail地址, 每次Git提交都会使用该信息
git config [--global] user.name # 查看用户名
git config [--global] user.email # 查看用户e-mail
git config --global --edit # 编辑~/.gitconfig(User-specific)配置文件, 值优先级高于/etc/gitconfig(System-wide)
git config --edit # 编辑.git/config(Repository specific)配置文件, 值优先级高于~/.gitconfig

}

Expand Down

0 comments on commit df2e5cc

Please sign in to comment.