ID = git_ask_00
How to run SVN operation in Git?
Most SVN operation can be reflected in Git
SVN | Git |
---|---|
checkout | git clone |
update | git pull |
check for modification | git diff HEAD |
add | git add |
undo add | git restore |
delete | git rm |
N/A | git commit |
commit | git push |
show log | git log, git reflog |
revert | git reset |
compare | git diff |
revision | commit-id or hash-id |
trunk | branch master |
N/A | working tree |
N/A | index tree |
working copy | HEAD tree |
Follow the following procedure to make it.
This is similar to create repository in SVN.
Later, we can checkout in local.
This operation is used to copy a project from server to local
SVN Export operation
git clone _address_in_github_
SVN Update operation
git pull
Make sure, every time when you are going to do modification, you working copy is the newest after synchronizing with the server
$ git pull
Already up to date.
The following command can be used to get current status of server:
git remote -v
git fetch origin master
git log -p master.. origin/master
Reference:
git 更新远程代码到本地仓库
Different from SVN, changes are needed to transfer to Index at first.
git add _filename_
git add *
git add . 会把本地所有untrack的文件都加入暂存区,并且会根据.gitignore做过滤,但是git add * 会忽略.gitignore把任何文件都加入
git commit -m "notes"
Now you changes are in HEAD
now.
Run git pull
again to make sure there is no conflict before push to server.
If there is any conflict, use VS Code
to resolve manually.
And after resolved, need to add
new file again and commit
again.
How to resolve conflict?
Type git status
to watch conflict detais
如何解决在使用git pull 拉取线上代码时发生的冲突
手动打开文件后会发现,代码会被<<<<<<<<<、==、 >>>>>>>>>等包围,这是冲突标记。关于冲突标记:<<<<<<和之间的内容是本地自己修改的,========与>>>>>>>>>之间的内容是别人修改的。
git push origin master
You can also change master to any branch you want.
If you haven’t cloned before, you need to link your current project to server by the following command:
git remote add origin
A1 It is an operation, git bash here, git is tool, bash is action, here is current directory.
Therefore, the final resut will be:
Open command terminal and change directory to your current folder.
Add folder in your working directory.
Then, git add .
, and then go to commit
and push
process.
For more detail, need to learn this set of command git log
, such as,
git log FETCH_HEAD
git log origin/master
For more detail, need to learn this set of command git diff
[1] git 更新远程代码到本地仓库
[2] https://blog.csdn.net/weixin_36564655/article/details/89682393
[3] 如何解决在使用git pull 拉取线上代码时发生的冲突