Me and another guy have recently been working on an app that is shared using git. As its a small team we have not bothered with branches so we thought we can just check into the main HEAD. Our problem seems to be when we both check in and push. Basically one of us gets fast-forward errors and cannot check in. Sometimes we can force the change in but this seems to strip out the other persons commits - not nice. The other person usually can commit OK but it seems to be preventing the other person to work concurrently.
We thought it was as easy as
Do a fetch to get latest commit and push out changes
but as mentioned this causes the above problems for us. This is a very simple workflow so we thought the commands to do it would be straight forward.
I guess is there anyone who got a workflow like this working using GIT ? What are the correct commands to use ?
Frank
It sounds like what you want to do is rebase
your local master branch before pushing your changes. This will allow you to pull in master from origin, and then apply your work "on top" of it.
So, your commands would be:
git pull origin master
<code code code>
git add .
git commit -m "some message about <code code code>"
git pull --rebase origin master
git push origin master
Git Ready has some really good documentation on pulling with the --rebase
flag.
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.