Search code examples
gitgithubclonebranching-and-merging

Git Clone Branch, Edit, then Merge with Master


I'm very nooby to using git branches with other users so I was hoping for some help regarding a project. My project has 3 branches(master, auth, and dev1). I am the user of the master branch and I recently cloned the auth branch to a local folder and edited it.

My question is...How do I (push?) my corrections to the auth branch and merge it with the master branch? Can I just (merge?) the edited auth branch with the master locally?

aka

Phil owns *master

Bob owns *auth

Phil clones *auth to local computer. Edits *auth and wants to then merge edited *auth with *master.


Solution

  • My question is...How do I (push?) my corrections to the auth branch and merge it with the master branch? Can I just (merge?) the edited auth branch with the master locally?

    You push your corrections to the auth branch with this following command (let's pretend the name of your remote repository is "banana"):

    git push banana auth
    

    If I'm reading your question correctly, you want to push your branches, THEN merge them. You can't do it in that order. It has to be "merge, THEN push." You can only merge "locally", then push the changes to your remote repo using the command above.

    By the way, for each branch, use the following command at least once:

    git push -u <branchName>
    

    This will associate your local branch with the remote one so you don't get any annoying messages saying "You don't have a default branch, waaaah!" or whatever that message is if you want to push ALL of your branches at once.

    As far as merging, the responses above have answered that.

    Hope this clears some things up!