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

Ryan-X

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

pewdie2pie

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>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to re-commit a past commit if someone overwrote my commit

How can I pull down a commit from Github (Enterprise) that I don't have locally?

Git commit squashed when merging upstream, how do I update my local repo

AWS CodePipeline recognizes my new GitHub commit fine - but how?

Why can I see a commit on GitHub but can't look at it on my local repository?

How do I reset git head to previous local commit and then push that commit to my remote

How can I get notifications when someone comments on my commit on GitHub?

Github not recognizing my account when i commit

When I push a project to Github, I have the files of the oldest commit, why?

In my first commit I am unable to push the changes as i already have .gitignore and README.md in my github,diff from local

Recover changes to README.md made online on github site that were lost when I made a commit from my local repo

i did git pull --rebase and now i have everyone else's commit in my branch - why

How do I verify a GPG key with my commit email address on GitHub?

How do I create a branch based on an old commit and make my local files reflect that commit?

How do I not commit my config.php file(completely ignore it, neither download or upload it) to Github when using VSCode?

Should I commit all my computer science homework assignments to GitHub?

How to revert / undo my last two pushes (commit and revert) in github?

How to commit-push ionic 3 blank to my GitHub repository?

Github: How would I move one repository into another preserving my commit history?

How to link my commits to my github account, without showing emailadress in commit?

Sync my Pull request with someone else commit some changes - Github

I have lose my previous commit github by gitbash

How to display the name of the latest commit on GitHub to my website?

I created a new local repository and can't push to Github because git think my commit doesn't have any files (ls-files show files)

How do I commit my code to github via gitbash?

Git on Linux MInt. I can't push commit to my GitHub account. Terminal breaks down

Why not appear on my Github profile contributions a commit after i copy my folder local and switch branch?

While adding my project to GitHub, do I also have to add the virtual environment folder and subsequently commit and push it or I can skip it?

How can I merge all my local commit before rebase my local branch from the main?