문제

I created a Git repository on BitBucket for a project with 5 committers. All of us are new to Git and are using TortoiseGit. We just have the master branch and all we want is a simple "SVN-like" workflow: get other people's changes, make some changes yourself, let other people see your changes.

One particular committer seems to be having a lot of trouble with Git and he's overwritten other people's changes several times now. Undoing the damage is very difficult, because I don't know much about Git either. I can't watch him as he uses Git, so I don't know exactly what he does, but I'd like to tell him: here's what to do to ensure this doesn't happen. For SVN that would be: before committing, always update first, merge your changes and test that everything still works. What should I tell him for Git?

도움이 되었습니까?

해결책

If you're going to use git, you should use the power git offers... branches!

On the assumption that you don't want to complicate the workflow any more than necessary though, simply tell your developer that before committing, always git pull --rebase. In a nutshell, this will: a) save off your local changes, b) pull remote changes (that is, changes others have committed and pushed), c) replay your local changes onto the new code base.

다른 팁

Have everyone pull from a 'team' source repo and push their work to their own repos. Then have an integration manager pull from all individual repos, merge it all together, and push it on to the team repo. This will ensure no one overwrites anyone else's work.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top