▲ 807 ▼ Well well well. (lemmy.ml) submitted 1 year ago by ipconf@lemmy.ml to c/programmer_humor@programming.dev 130 comments fedilink hide all child comments Yeah learned this the hard way.
[–] GissaMittJobb@lemmy.ml 9 points 1 year ago (6 children) Don't be afraid of rebases, they are an essential tool in Git. This particular fear can only be addressed by understanding. permalink fedilink source parent hideshow 6 child comments replies: [–] Eiri@lemmy.ca 1 point 1 year ago (5 children) I don't understand it. Every time I see something about a rebase it's some purist telling me it's "cleaner". Never got it to do what it says on the tin, and never hit a situation that I couldn't solve using more straightforward tools like merge. permalink fedilink source parent hideshow 5 child comments replies: [–] GissaMittJobb@lemmy.ml 2 points 1 year ago (4 children) What's your mental model for a Git commit, and a Git branch? Once I properly learned those two concepts, understanding rebases became a lot easier. I'll try to explain it to the best of my abilities. Think of a commit being a patch - a description of how to take a particular file from one state to another A branch is a list of patches to be applied in order, from the point where the branch was created until the last commit on the branch When you rebase a particular branch, what you're essentially doing is taking all of the commits that are currently on your branch, checking out the other branch, and then applying each of the patches in order on that new branch. A rebase can be cleanly applied if the premise for each commit has not changed when applied, but if the premise has changed, you get a conflict to be resolved before being able to continue the rebase. I mentally model a rebase a bit as a fast version of how it would look like to build the branch I was on, but on top of the branch I'm rebasing on. permalink fedilink source parent hideshow 4 child comments replies: [–] Eiri@lemmy.ca 1 point 1 year ago (3 children) That's a good explanation of what it's supposed to do. That was how I understood it as well. But anytime I've tried it, I've ended up with conflicts where there shouldn't be (like, I already solved that conflict when I merged earlier) and/or completely undesirable results in the end (for instance, some of my changes are just NOT in the result). So I just gave up on the whole feature. Simpler to just merge the source branch into mine. permalink fedilink source parent hideshow 3 child comments replies: [–] GissaMittJobb@lemmy.ml 1 point 1 year ago (2 children) Depending on how structured your commits have been, it can either be very difficult to get a rebase through or a complete breeze. There are some features to make it easier - rerere being the main one I'm thinking about. permalink fedilink source parent hideshow 2 child comments replies: [–] Eiri@lemmy.ca 1 point 1 year ago (1 child) Is that what interactive rebase tools use? I don't do CLI git permalink fedilink source parent hideshow 1 child comment replies: [–] GissaMittJobb@lemmy.ml 1 point 1 year ago You enable it using git config, after that it will apply to whatever frontend you're using. permalink fedilink source parent
[–] Eiri@lemmy.ca 1 point 1 year ago (5 children) I don't understand it. Every time I see something about a rebase it's some purist telling me it's "cleaner". Never got it to do what it says on the tin, and never hit a situation that I couldn't solve using more straightforward tools like merge. permalink fedilink source parent hideshow 5 child comments replies: [–] GissaMittJobb@lemmy.ml 2 points 1 year ago (4 children) What's your mental model for a Git commit, and a Git branch? Once I properly learned those two concepts, understanding rebases became a lot easier. I'll try to explain it to the best of my abilities. Think of a commit being a patch - a description of how to take a particular file from one state to another A branch is a list of patches to be applied in order, from the point where the branch was created until the last commit on the branch When you rebase a particular branch, what you're essentially doing is taking all of the commits that are currently on your branch, checking out the other branch, and then applying each of the patches in order on that new branch. A rebase can be cleanly applied if the premise for each commit has not changed when applied, but if the premise has changed, you get a conflict to be resolved before being able to continue the rebase. I mentally model a rebase a bit as a fast version of how it would look like to build the branch I was on, but on top of the branch I'm rebasing on. permalink fedilink source parent hideshow 4 child comments replies: [–] Eiri@lemmy.ca 1 point 1 year ago (3 children) That's a good explanation of what it's supposed to do. That was how I understood it as well. But anytime I've tried it, I've ended up with conflicts where there shouldn't be (like, I already solved that conflict when I merged earlier) and/or completely undesirable results in the end (for instance, some of my changes are just NOT in the result). So I just gave up on the whole feature. Simpler to just merge the source branch into mine. permalink fedilink source parent hideshow 3 child comments replies: [–] GissaMittJobb@lemmy.ml 1 point 1 year ago (2 children) Depending on how structured your commits have been, it can either be very difficult to get a rebase through or a complete breeze. There are some features to make it easier - rerere being the main one I'm thinking about. permalink fedilink source parent hideshow 2 child comments replies: [–] Eiri@lemmy.ca 1 point 1 year ago (1 child) Is that what interactive rebase tools use? I don't do CLI git permalink fedilink source parent hideshow 1 child comment replies: [–] GissaMittJobb@lemmy.ml 1 point 1 year ago You enable it using git config, after that it will apply to whatever frontend you're using. permalink fedilink source parent
[–] GissaMittJobb@lemmy.ml 2 points 1 year ago (4 children) What's your mental model for a Git commit, and a Git branch? Once I properly learned those two concepts, understanding rebases became a lot easier. I'll try to explain it to the best of my abilities. Think of a commit being a patch - a description of how to take a particular file from one state to another A branch is a list of patches to be applied in order, from the point where the branch was created until the last commit on the branch When you rebase a particular branch, what you're essentially doing is taking all of the commits that are currently on your branch, checking out the other branch, and then applying each of the patches in order on that new branch. A rebase can be cleanly applied if the premise for each commit has not changed when applied, but if the premise has changed, you get a conflict to be resolved before being able to continue the rebase. I mentally model a rebase a bit as a fast version of how it would look like to build the branch I was on, but on top of the branch I'm rebasing on. permalink fedilink source parent hideshow 4 child comments replies: [–] Eiri@lemmy.ca 1 point 1 year ago (3 children) That's a good explanation of what it's supposed to do. That was how I understood it as well. But anytime I've tried it, I've ended up with conflicts where there shouldn't be (like, I already solved that conflict when I merged earlier) and/or completely undesirable results in the end (for instance, some of my changes are just NOT in the result). So I just gave up on the whole feature. Simpler to just merge the source branch into mine. permalink fedilink source parent hideshow 3 child comments replies: [–] GissaMittJobb@lemmy.ml 1 point 1 year ago (2 children) Depending on how structured your commits have been, it can either be very difficult to get a rebase through or a complete breeze. There are some features to make it easier - rerere being the main one I'm thinking about. permalink fedilink source parent hideshow 2 child comments replies: [–] Eiri@lemmy.ca 1 point 1 year ago (1 child) Is that what interactive rebase tools use? I don't do CLI git permalink fedilink source parent hideshow 1 child comment replies: [–] GissaMittJobb@lemmy.ml 1 point 1 year ago You enable it using git config, after that it will apply to whatever frontend you're using. permalink fedilink source parent
[–] Eiri@lemmy.ca 1 point 1 year ago (3 children) That's a good explanation of what it's supposed to do. That was how I understood it as well. But anytime I've tried it, I've ended up with conflicts where there shouldn't be (like, I already solved that conflict when I merged earlier) and/or completely undesirable results in the end (for instance, some of my changes are just NOT in the result). So I just gave up on the whole feature. Simpler to just merge the source branch into mine. permalink fedilink source parent hideshow 3 child comments replies: [–] GissaMittJobb@lemmy.ml 1 point 1 year ago (2 children) Depending on how structured your commits have been, it can either be very difficult to get a rebase through or a complete breeze. There are some features to make it easier - rerere being the main one I'm thinking about. permalink fedilink source parent hideshow 2 child comments replies: [–] Eiri@lemmy.ca 1 point 1 year ago (1 child) Is that what interactive rebase tools use? I don't do CLI git permalink fedilink source parent hideshow 1 child comment replies: [–] GissaMittJobb@lemmy.ml 1 point 1 year ago You enable it using git config, after that it will apply to whatever frontend you're using. permalink fedilink source parent
[–] GissaMittJobb@lemmy.ml 1 point 1 year ago (2 children) Depending on how structured your commits have been, it can either be very difficult to get a rebase through or a complete breeze. There are some features to make it easier - rerere being the main one I'm thinking about. permalink fedilink source parent hideshow 2 child comments replies: [–] Eiri@lemmy.ca 1 point 1 year ago (1 child) Is that what interactive rebase tools use? I don't do CLI git permalink fedilink source parent hideshow 1 child comment replies: [–] GissaMittJobb@lemmy.ml 1 point 1 year ago You enable it using git config, after that it will apply to whatever frontend you're using. permalink fedilink source parent
[–] Eiri@lemmy.ca 1 point 1 year ago (1 child) Is that what interactive rebase tools use? I don't do CLI git permalink fedilink source parent hideshow 1 child comment replies: [–] GissaMittJobb@lemmy.ml 1 point 1 year ago You enable it using git config, after that it will apply to whatever frontend you're using. permalink fedilink source parent
[–] GissaMittJobb@lemmy.ml 1 point 1 year ago You enable it using git config, after that it will apply to whatever frontend you're using. permalink fedilink source parent