I didn't find a clear answer to this one (many things are overwhelming to newbies at git):
I have a local repo and a remote at github consisting of files: A, B and C.
My draw depicts the files and their changes:
local remote
A -------> A
B <------- B
C <------> C
In the evening, I'm just staring the repos. Is there any chance to finish promptly? Anyone?
Commit all of your local changes first. Make sure your working directory is clean:
$ git status
should return: nothing to commit, working directory clean
Then, pull in the remote's changes:
$ git pull remote-name branch-name
# it's probably git pull origin master
Then push your changes to share with the remote:
$ git push origin master
My local workfolw allows your to untie the pull and push stages properly, and it is the following:
Store your local uncommitted changes with git stash
:
git stash
Update your local repo with remote version one:
git pull
So you get:
local remote B <------- B C <------- C
Apply local changes, and merge all inconsistiences, fix the files if any require, and add them into index, and commit merge:
git stash pop vim ... git add . git commit
Edit file C
, and commit it.
vim C git add C git commit
Push changes into remove repo:
git push
So you'll get:
local remote A -------> B C -------> C
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.