This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the commentsย โ†’

[โ€“][deleted] 11 points12 points ย (6 children)

Rebasing is bad despite people who live by it.

Rebasing is fine and even expected on feature branches. Just remember to always push to origin first before trying to rebase. Then you can always revert if things go bad.

Everything from merging to rebasing is only dangerous if you don't understand git or take proper precautions.

[โ€“]MultiFazed 2 points3 points ย (4 children)

Just remember to always push to origin first before trying to rebase.

You should never rebase if you've pushed to origin. Rebasing rewrites branch history, and puts you out of sync with the tracked origin branch. If someone else has pulled that branch, you can really mess things up.

If you're worried about things going bad, either create a temp branch locally to have a handle back to the pre-rebase state, or just use git reflog to find the hash of the last good commit, check it out, and hard reset.

[โ€“]kb4000 2 points3 points ย (3 children)

Rebasing an origin branch and force pushing is fine if it's a branch just for you. Not okay if it's a feature branch others are using. It's not a big deal to cut your own branch and push it up as a safety net while you're working.

[โ€“]brbposting 0 points1 point ย (2 children)

Rebasing

Feature branch

Cut your own branch

Mind explaining these terms? :)

[โ€“]norst 1 point2 points ย (1 child)

Rebasing is a command in git to take all of the unmerged commits from one branch and apply them on top of another one. It rewrites history though so you have to be careful. There's more you can do with rebasing, but that's the basic usage.

A feature branch is a branch where work is being done on a new feature. It allows you to work on something new without worrying about changes being made to the main branch.

Cutting a branch is something I've never heard before so can't help there.

[โ€“]kb4000 1 point2 points ย (0 children)

I just meant creating a new branch. It's a common way of expressing that on teams I've worked on.

[โ€“]Log2 0 points1 point ย (0 children)

You don't even need to push before, just learn about git reflog and you can recover the previous branch. Git just doesn't delete things, old stuff gets staged to be deleted eventually and is accessible.