ninetydegrees: Photo: octopus tentacles (tentacles)
ninetydegrees (90d)☕ ([personal profile] ninetydegrees) wrote in [site community profile] dw_dev_training2012-08-30 01:24 pm
Entry tags:

Git: more newbie questions: the sequel

Once your request has been pulled into develop and you've updated develop what do you do with your 'old' branch (local and remote)?

Edit: http://git-scm.com/book/en/Git-Branching-Remote-Branches says this:

Suppose you’re done with a remote branch — say, you and your collaborators are finished with a feature and have merged it into your remote’s master branch (or whatever branch your stable codeline is in). You can delete a remote branch using the rather obtuse syntax git push [remotename] :[branch].

Is that what needs to be done here? If so what about the local branch and should we wait until code is pushed live?

Answer 1: local can be deleted w/ git branch -d BRANCHNAME (not merge needed yay)

Answer 2: remote can be deleted using git push origin :BRANCHNAME
cesy: "Cesy" - An old-fashioned quill and ink (Default)

[personal profile] cesy 2012-09-01 05:50 am (UTC)(link)
It's sometimes possible that you've committed something that's not on the website yet. If you're on that branch, and do git push origin bug4606/moderated_entry, that will send it there, or tell you if there's a misalignment.

The thing with rebasing is that it rewrites history by changing around the order of things. This is a bad idea if someone else has built code off yours, or is otherwise relying on yours, so the central repo must never do it. But opinions vary on when it's useful for an individual developer, and I really like it for keeping things clean so you can see exactly what changed. Some repos will also insist on it to make sure your pull requests merge cleanly and don't clash with anything that's been done in the meantime.

If develop is up to date, you go on your bug branch, and do git rebase develop, and that will essentially move your stuff so that it looks as if you branched off develop's current status and then did your coding, instead of you having branched off a month ago and then taking several days to do your coding and develop moving on in the meantime. If there's anything conflicting with what's been done on develop in the meantime, it will tell you and highlight it and walk you through fixing it.

If it's a branch you've already pushed to github, you then have to force it up there, because github will complain that you're rewriting history, so you have to do git push origin bugnumber -f. But if you've got a pull request open, that will automatically update and clean up the pull request as well.
cesy: "Cesy" - An old-fashioned quill and ink (Default)

[personal profile] cesy 2012-09-05 06:59 pm (UTC)(link)
Yes, essentially.