git commands as hg commands
I had worked with Mercurial but now working with Git. I have some difficulty with understanding Git, can you help me, what are the alternatives to Git commands like Mercurial:
hg up -C
hg revert --all
hg purge
If I have some conflicts from the Mercurial command " hg up ", I can run commands like hg revert --all & hg purge or hg up -C .
What can I do after git pull and file conflicts if I don't want to continue, but just revert to the original state, or update files without conflicts (like hg up -C )?
You can refer to Git hg rosetta stone
For example:
hg update -C git checkout -f
hg revert -a git reset --hard
hg purge git clean -fd
So see:
git checkout man page git reset man page git clean man page Also:
git reset ” and “ git checkout ”?". git reset --hard hash ” and “ git checkout hash ”?" And finally: "Undo git pull, how to bring repos to old state"
What can I do after "git pull" and file's conflicts, if I don't want to continue, but just revert to the original state
When you do a git pull , you are really doing a git fetch followed by either a git merge or a git rebase . Assuming your pull strategy is using merge, then your question is how can you undo the merge done during a git pull . One clean way to undo a merge is to reset your local branch to the latest commit:
git reset --hard <SHA-1 hash of latest commit>
What can I do ... update files without conflicts (like hg up -C)
When you do a git pull , you bring in the changes to all the files from the remote branch. Usually you would not want to update only files which have no conflicts. Git is a workspace-based version control system, as opposed to something like SVN, which is a file-based VCS.
If you really want to try doing a git pull and then update only files which are not in conflict, then you can use the following command to identify which files have conflicts:
git diff --name-only --diff-filter=U
Then for each file in the list, you can do a git reset on it:
git checkout -- filename_in_conflict
链接地址: http://www.djcxy.com/p/94788.html
上一篇: 如何合并在GIT中修改的文件
下一篇: git命令作为hg命令
