Santosh Kumar
Santosh Kumar

Reputation: 27875

Edited a file from GitHub, conflict in pushing?

This is my scenario:

Created and uploaded a project on GitHub. Did some commits (ahead of origin/master by n commits). While viewing the repository on GitHub through web browser I found a minor error and can't control myself from fixing it using GitHub's very own code editor.

After coming to my local repository, what do I do now? I neither want to lose the changes from GitHub's editor nor want to loose changes that I had already commited.

(I have single branch on that repository (master) and I am only the developer)

Upvotes: 1

Views: 92

Answers (2)

Nick H
Nick H

Reputation: 11535

You can do a simple git pull, but I'd recommend doing a git pull --rebase as this will avoid having to have an additional merge commit joining the two development histories, thus keeping your history tidy.

Here's a bit of explanation on rebase pulls and how you can enable them by default: http://blog.aplikacja.info/2010/11/git-pull-rebase-by-default/

Upvotes: 1

Chris Mansley
Chris Mansley

Reputation: 782

You will need to do a git pull, which fetches the changes from Github and merges the two heads.

If you look at the first graphic here, it explains a similar situation.

Upvotes: 1

Related Questions