git - How do I push corrected commits to a remote repository? -
i realized had set user.name
wrong, used this answer fix incorrect commits. locally, worked great. however, git tells me
$ git status # on branch master # branch , 'origin/master' have diverged, # , have 15 , 15 different commits each, respectively. # (use "git pull" merge remote branch yours) # nothing commit, working directory clean
so, need somehow send changes github repository, when push:
$ git push warning: gnome-keyring:: couldn't connect to: /run/user/mspencer/keyring-uscl41/pkcs11: no such file or directory username 'https://github.com': ibeliever password 'https://ibeliever@github.com': https://github.com/ibeliever/weather-desktop.git ! [rejected] master -> master (non-fast-forward) error: failed push refs 'https://github.com/ibeliever/weather-desktop.git' hint: updates rejected because tip of current branch behind hint: remote counterpart. merge remote changes (e.g. 'git pull') hint: before pushing again. hint: see 'note fast-forwards' in 'git push --help' details.
i'm not quite sure how fix this. i've dealt remote changes before, , solved them pulling , merging, i'm not sure in case. need update github repository corrected names, how do that?
steven's answer correct dangerous. careful when use forced push.
first of all, git push -f
force push local branches remote repository.
to push master branch, must specify it.
git push -f origin master
when doing want tell other people have access repository pull down changes before make additional commits. otherwise branches diverge in crazy ways don't want deal with.
Comments
Post a Comment