git和svn的区别
1 2 3
| Git是分布式的,SVN是集中式的。Git支持离线工作,SVN必须联网才能正常工作。 Git复杂概念多,SVN简单易上手。Git分支是指针指向某次提交,而SVN分支是拷贝的目录,这个特性使Git的分支切换非常迅速,创建成本非常低。 Git有本地分支,SVN无。
|
git核心概念
1 2 3 4 5
| 工作流:工作区(Workspace)电脑中实际的目录,暂存区(Index)类似于缓存区域,仓库区(Repository)本地仓库和 远程仓库。 git add:从工作区提交到暂存区 git commit:从暂存区提交到本地仓库 git push或git SVN dcommit:从本地仓库提交到远程仓库 以下为git命令
|


git-svn常用命令
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| $ git svn clone -s [repository]
$ git svn info
$ git svn fetch
$ git svn rebase
$ git svn dcommit
$ svn copy [remote_branch] [new_remote_branch] -m [message]
$ git checkout -b [local_branch] [remote_branch]
|
Git命令指南
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
| $ git init
$ git clone [url]
$ git config -l
$ git config --global alias.co checkout $ git config --global alias.ci commit $ git config --global alias.st status $ git config --global alias.br branch
$ git config [--global] user.name [name] $ git config [--global] user.email [email address] Git 用户的配置文件位于 ~/.gitconfig Git 单个仓库的配置文件位于 ~/$PROJECT_PATH/.git/config
$ git add .
$ git add <file1> <file2> ...
$ git add <dir>
$ git rm [file1] [file2] ...
$ git rm --cached [file]
$ git mv [file-original] [file-renamed] 把文件名 file1 添加到 .gitignore 文件里,Git 会停止跟踪 file1 的状态。
$ git branch
$ git branch -a
$ git branch [branch-name]
$ git checkout -b [new_branch] [remote-branch]
$ git checkout [branch-name]
$ git merge [branch]
$ git cherry-pick [commit]
$ git branch -d [branch-name]
$ git push [remote] :[remote-branch]
$ git commit -m [message]
$ git commit -a
$ git commit -v
$ git commit --amend -m [message]
$ git push [remote] [remote-branch]
$ git fetch [remote]
$ git remote -v
$ git remote show [remote]
$ git remote add [remote-name] [url]
$ git pull [remote] [branch]
$ git pull --rebase [remote] [branch]
$ git checkout [file]
$ git checkout .
$ git checkout [commit]
$ git reset [file]
$ git reset --hard
$ git reset [commit]
$ git reset --hard [commit]
$ git revert [commit]
$ git stash
$ git stash pop
$ git status
$ git diff [file]
$ git diff --cached [file]
$ git log
$ git log --author=someone
$ git log -p [file]
$ git show [commit]
|
2020/7/13 SVNupdate失败,本地文件中有打开更新的文件。
报错:需要执行clean up命令,执行并勾选break lock,解决。
git常用指令地址:git命令:阮一峰