Bad git pull

You pull. You have conflicts. You want to go back to how it was before
pulling and push your version. How do you do that without editing the
file line by line?

Milan D. wrote:

You pull. You have conflicts. You want to go back to how it was before
pulling and push your version. How do you do that without editing the
file line by line?

Use git mergetool?

Anyway, this question is probably better asked in a Git forum.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Milan D. wrote:

You pull. You have conflicts. You want to go back to how it was before
pulling and push your version. How do you do that without editing the
file line by line?

If conflicts occur during a pull the auto-merge should fail leaving the
changes in your working tree. At this point you should be able to run:

git reset --hard

to return your working tree to the tip of the current branch.

P.S. I agree this question would be more appropriate for a git forum.

Marnen Laibow-Koser wrote:

Milan D. wrote:

You pull. You have conflicts. You want to go back to how it was before
pulling and push your version. How do you do that without editing the
file line by line?

Use git mergetool?

Milan, If you are interested in seeing a short demonstration of conflict
resolution in git you can watch my screencast on the subject here:
http://vimeo.com/5728959

2009/8/19 Milan D. [email protected]:

You pull. You have conflicts. You want to go back to how it was before
pulling and push your version. How do you do that without editing the
file line by line?

Just checkout your version from your local repository again. If the
pull failed due to conflicts then so will a push, in fact I believe it
is always best to pull, sort the conflicts, commit then push.

Colin

Colin L. wrote:

Just checkout your version from your local repository again. If the
pull failed due to conflicts then so will a push, in fact I believe it
is always best to pull, sort the conflicts, commit then push.

From man git-merge:
HOW TO RESOLVE CONFLICTS
After seeing a conflict, you can do two things:

   o   Decide not to merge. The only clean-ups you need are to reset 

the index file to the HEAD
commit to reverse 2. and to clean up working tree changes
made by 2. and 3.; git-reset
–hard can be used for this.

git pull is basically git fetch + git merge. If conflicts occur this
should happen in the git merge phase. From that point you can choose to
resolve the conflicts and commit or, as stated above, choose not to
merge. Using git reset --hard can be used for the later as I stated in
an earlier post.

Thank you guys. git merge tool is awesome!!! :slight_smile:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs