0

Newbie Alert! .............. Hi guys, I was rather silly yesterday and downloaded my project from Github and then proceeded to edit that new project locally, as I deemed that easier than resolving conflicts with my previous local project.

I went to push last night and it asked me to pull, as it was effectively seeing a new Git repository, with no history. I then went to pull, as requested, and it killed my app and only partly pulled from Github. It was saying there were merge conflicts to resolve, so to ensure I didn't lose my work...I opted to do a hard reset and hey presto... the app works again locally as before. Thank goodness.

How would I go about either:

  • a) resolving those heavy merge conflicts
  • b) getting Git to recognise that my local version is in fact more up to date than Github (if different from a)
  • c) am I just best creating a new repository?

1 Answer 1

1

Here's what we currently do.

1. From a clean machine, clone project from GitHub using "git clone https://github.com/path_to_project.git".
2. Make local changes and do a "git add file_name" for each updated file/object.
3. After "git add", we do a "git commit -m "commit_message_here"".
4. After "git commit", we first do a "git fetch origin" to get updates from other people working on our project.
5. After "git fetch", we do a "git merge origin/master" to merge updates into our local copies.
6. In case of "conflicts", we do it manually. Files with conflicts will be marked and prefixed/suffixed with some strings.
7. After resolving our conflicts, we again do "git add" for those resolved files... then "git commit" again.
8. Finally, it is safe to do "git push origin master".

I recommend to use "fetch+merge" vs. "pull". I can't find the reference from a forum I read that details why it is better.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.