Git常用命令:
初始化仓库:git init
查看状态:git status
添加文件到暂存区:git add <file>
提交暂存区内容:git commit -m "commit message"
查看提交历史:git log
创建分支:git branch <branch_name>
切换分支:git checkout <branch_name>
合并分支:git merge <branch_name>
删除分支:git branch -d <branch_name>
查看所有分支:git branch -a
拉取远程仓库更新:git pull
推送本地更改到远程仓库:git push
克隆远程仓库:git clone <repository_url>
SVN常用命令:
检出代码:svn checkout <repository_url> <local_directory>
更新本地代码:svn update
提交更改:svn commit -m "commit message"
查看状态:svn status
添加新文件:svn add <file>
删除文件:svn delete <file>
查看日志:svn log
切换分支/标签:svn switch <repository_url>
导出仓库:svn export <repository_url> <local_directory>
查看差异:svn diff
注意问题提:svn up时,提示无法更新,使用svn up --force强制更新,有时会弹出如下提示:
Conflict discovered in 'xxxxxx'.
Select: (p) postpone, (df) diff-full, (e) edit,
(mc) mine-conflict, (tc) theirs-conflict,
(s) show all options:
可以选择df查看冲突信息。
以下是每个选择的意思:
(e) edit - change merged file in an editor #直接进入编辑
(df) diff-full - show all changes made to merged file #显示更改至目标文件的所有变化
(r) resolved - accept merged version of file
(dc) display-conflict - show all conflicts (ignoring merged version) #显示所有冲突
(mc) mine-conflict - accept my version for all conflicts (same) #冲突以本地为准
(tc) theirs-conflict - accept their version for all conflicts (same) #冲突以服务器为准
(mf) mine-full - accept my version of entire file (even non-conflicts)#完全以本地为准
(tf) theirs-full - accept their version of entire file (same) #完全以服务器为准
(p) postpone - mark the conflict to be resolved later #标记冲突,稍后解决
(l) launch - launch external tool to resolve conflict
(s) show all - show this list