9

I am using beanstalkapp and i see conflict in front of a branch, just conflict isn't very helpful. But even when i do git status, i don't see anything which says there is a conflict. Any help to find where can i find the files being conflicted? Here is a image from dashboard

localhost
  • 822
  • 2
  • 20
  • 51
  • I think you're going to need to explain more of what you did. Did you make the changes on a branch (rather than master)? Did you merge the branch? Did you merge changes from elsewhere? Without more detail about what you did, it will probably be hard to help you resolve the problem. – Jonathan Leffler Apr 19 '16 at 14:57

1 Answers1

6

If you see conflict on the server side but you don't see it on your side - you might have a different content. First of all do a git pull from the remote server to be sure you are up to date.

i want to go back to a commit, couple of days back and discard anything after that

Read out this full detailed answer which will explain in details whats exactly you can do.

Basically you have several options but the main options are:

  • git reset
  • git checkout -b <sha-1>

How to find out the required commit?

You can do it with the log command or with the git reflog

git reflog

git reflog will display any change which updated the HEAD and checking out the desired reflog entry will set the HEAD back to this commit.

Every time the HEAD is modified there will be a new entry in the reflog

# print teh git reflog
git reflog

# find out the desired commit (of the index in the reflog) 
git checkout HEAD@{...}

enter image description here


git checkout

# Find out the desired commit which you wish to go back to 
# Once you have it checkout the commit to a new branch
git checkout -b <new branch> <commit_id>

Another option is the git reset

git reset HEAD --hard <commit_id>

"Move" your head back to the desired commit.
As before find out the desired commit and then tell your repository to point on this commit.

# read the documentation about the different flavors of the reset (hard/mixed/soft)
git reset HEAD --hard <sha-1>

And now your repository is "back" to the desired commit.

Community
  • 1
  • 1
CodeWizard
  • 128,036
  • 21
  • 144
  • 167
  • the problem is i don't know if the conflict is on remote repo or mine. surely i want to discard any commit after a certain commit or sync the changes. It is quite vague that i don't know which file have conflict. – localhost Apr 23 '16 at 23:52
  • You can check out the remote branch to a new local branch and then `diff` them to view which file cause the conflict – CodeWizard Apr 23 '16 at 23:53
  • 1
    The conflict can never be on the remote. The remote has a commited code and once you try update the local branch it will show a conflict with the local code its trying to merge. Use this command to follow the changes of the given file: `git log --follow ` – CodeWizard Apr 23 '16 at 23:55
  • how can i check diff between those branches and as for it its very deep nested subfolder that i really don't understand.when i do reset HEAD --hard and then push, i m scared of pushing stupid local changes to server. – localhost Apr 24 '16 at 00:29
  • First of all you can always take the current branch and make a local copy: `git checkout -b `. now you can do the reset and before pushing compare the branches with the diff or the pull command to verify what you are pushing. But if you do a reset there should not be any difference. – CodeWizard Apr 24 '16 at 00:33
  • i get this error when i do hard reset fatal: `Cannot do hard reset with paths.` I just want one branch to reset or just one branch if i can download it again. i have other branches which have latest work and don't want to disturb those. – localhost Apr 25 '16 at 08:24
  • so i did on the branch that was conflicted, `git checkout ` yet i see conflict on the repo. – localhost Apr 25 '16 at 09:11