Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to push my local commit when my github have another commit and i forgot to pull my commit in github

Hi i’m here to asking you, how to push my commit/chage(s) when i have another commit and i forgot to pull the commit from github.
This is the chronology: when i’m no have another work, i decide to make own project and i use git to be my vcs, and then i make my project to be repository.
A few day’s later, i decide to remoting my github.
Everything is alright until the problem come. In one day, i’m edit my README.md and save the change, in git same to but a different is i updating my source code and save the change. After that i’m push my commit and this is happent.
Screen shoted the problem
But in here, i’m not realize i’m forgot to pull a commit from github until i’m realized that.

So please help me! I stuck in this condition! Please!
And i’m sorry if my English is bad

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

So, basically your solution might be to pull the changes from GitHub (that is, if I understand correctly you have did some changes to you remote Github – updated your README.md – not from your local – now you want that change to be reflected in your local and you need to push your new changes in the local to the remote).
The best solution would be to first add all your changes to staging and then committing by doing:

git add .
git commit -m "Your commit message (One-liner of your change)"

and then do a rebase as follows:

git pull --rebase

Rebasing will pull the changes from the remote, and re-apply your local changes on top of it, thus your local repo is now in sync with the remote repo (they are essentially in the same state). Now you can do the push:

git push  <REMOTENAME> <BRANCHNAME>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading