I’ve been using git alone for a long time, but now need to include many artists in a collaborative project.
These people are fairly new to git, so I’ve written the following (likely incorrect) instructions for checking out another person’s branch:
- Open the Git GUI and open our repository
- Remote>Fetch From>origin
- Branch>Checkout>(the branch you want)
- Stage, commit, and push as normal
Attempting to commit after using these instructions results in a warning about committing to a detached head. If they try to push these commits, nothing seems to happen.
So what is the correct way to have multiple people on the same branch? I’m hoping it’s simpler than what I wrote above, people are already screwing things up.
Ask them to create first fork your repository. It’s then easier for them to push to their own remotes and file a pull request to your remote. Once they have forked, they can clone it to their local and then create a new branch like so:
git checkout -b feature_branch
This will create the new branch straight from where your remote master branch was, otherwise it’s better do
git checkout -b feature_branch origin/master.
Ask them to then push this branch to their remote. If their remote name is own_remote, pushing this feature branch will create a new branch
own_remote/feature_branch. Since they have cloned the repository from their remote, they can push to it (in that case that remote would be
origin by default). If they want to push the feature_branch to their remote, they can do it like so:
git push origin feature_branch
Then if they think their changes are worthwhile and need to go it the main development branch (which is yours), they can send you a
Answered By – gravetii