This workflow is scary. A rebase should not be part of any everyday workflow and must be reserved _only_ for exceptional situations. Rebasing can cause the loss of history and developers should be as careful with it as system admins are with `sudo`. I can't recommend any workflow that includes it without treating is as a terrifying and scary thing. How easy is it to accidentally remove a line during interactive rebas…
Git Workflow Basics
31–40 of 77 posts
Re: Git Workflow Basics
#32Earlier quoted context omitted.
Ah, sorry, I'm probably mis-understanding a "squash merge". I thought you meant you have a graph like this: C -> D -> E / A -> B then you "squash merge" S------ / \ A -> B -> F where S is C + D + E. Whereas a rebase + (now fast-forward) merge would be A -> B -> C' -> D' -> E' and, if squashed during rebase -i or by some other means A -> B -> S It seems you're saying a "squash merge" is the last one, I thought it was…
That’s right. `git merge --squash` doesn’t even make a commit, it just updates the working tree and index to look like the post-merge contents — it’s then up to you to actually commit. So yeah, you don’t even end up with a merge commit.
(One thing I really love about git is that it's a tool I use extremely often (it's something like, 20% of the commands I run in my terminal), yet I learn something new and useful all the time.)
Re: Git Workflow Basics
#33This workflow is scary. A rebase should not be part of any everyday workflow and must be reserved _only_ for exceptional situations. Rebasing can cause the loss of history and developers should be as careful with it as system admins are with `sudo`. I can't recommend any workflow that includes it without treating is as a terrifying and scary thing. How easy is it to accidentally remove a line during interactive rebas…
> How easy is it to accidentally remove a line during interactive rebase and lose all work associated with it? This is not only not easy, it's actually very difficult. If you drop something in an interactive rebase, you can reset your HEAD to the HEAD commit from before your rebase. It's a bit arcane, and has its own dangers, but it's also important to be clear that rebases are not destructive unless a git gc runs be…
Re: Git Workflow Basics
#34Re: Git Workflow Basics
#35Ugh, not this again. How many threads like this do we need before folks accept that git is not the solution to whatever problem we have?
Re: Git Workflow Basics
#36Earlier quoted context omitted.
Rebase is absolutely a part of my everyday workflow, and the rest of my team's workflow as well. (Yesterday I had to show our CTO how to use it, because the rest of the team was getting annoyed by his merge commits.) Our workflow is: - locally, commit to local master or a local branch - occasionally checkout local master (if necessary) and pull using the 'rebase after fetch' option. - if we had local master commits,…
> annoyed by his merge commits Getting rid of merge commits is literally the only benefit of your workflow over the standard branching model.
This may sound counter-intuitive, because you're thinking it's the same conflict either way. Most of the time it is; if you and someone else changed the same bit of code, the conflict will be shown to you the same way whether you merge or rebase. Those are easy to fix. What's harder is when someone reorganizes some code without making significant changes to it. In a merge, you'll see changes all over the place, but in a rebase git can usually figure out the new line numbers, and may not indicate a conflict at all. The other area where my team has had difficulty with merges is in Visual Studio sln and csproj files. When you add new projects to a solution or new references to a project, git can present a very confusing diff during a merge conflict. But for rebase only your additions are highlighted, and most of the time you can solve the conflict with "use theirs before mine".
Re: Git Workflow Basics
#37This workflow is scary. A rebase should not be part of any everyday workflow and must be reserved _only_ for exceptional situations. Rebasing can cause the loss of history and developers should be as careful with it as system admins are with `sudo`. I can't recommend any workflow that includes it without treating is as a terrifying and scary thing. How easy is it to accidentally remove a line during interactive rebas…
https://git-scm.com/docs/git-reflog
> …or force-pushed by accident
Well, you could nuke git folder "by accident" as well :) Jokes aside, don't force-push to "other's" branches).
Re: Git Workflow Basics
#38This workflow is scary. A rebase should not be part of any everyday workflow and must be reserved _only_ for exceptional situations. Rebasing can cause the loss of history and developers should be as careful with it as system admins are with `sudo`. I can't recommend any workflow that includes it without treating is as a terrifying and scary thing. How easy is it to accidentally remove a line during interactive rebas…
if you're going to store commit hashes externally instead of using the reflog then it makes no difference whether you use rebase, merge, or even cherry-pick or reset.
also, sudo itself poses no risk; it's much more important to evaluate what you're running, instead of a blanket restriction on what is just another tool. if I run "cd /; rm -rf *" on my desktop, it doesn't really matter whether I'm running as root or as my user, I'm going to have a bad day. "curl | sh" is equally as dangerous as "curl | sudo sh".
Re: Git Workflow Basics
#39When we write bigger features we always need at least two dev. One writing the front end (HTML templates) and one the backend (whatever populates the templates, makes sql query). We both need immediate feedback. I design the models around the templates so i need the templates at least partly to work. He needs the models to properly do his work either (if he wrote the templates before I write the models, the development of the whole feature would slow down and it is not nice to only work with a lorem impsum all the time. We also get very detached from the actual feature that way.
How do you manage those situations? Just do one branch per feature and if that feature requires more work, then just let two people work on that feature?
Re: Git Workflow Basics
#40But if you're rebasing your commits, haven't you lost that? The concerns about a "clean commit graph" seem more aesthetic than functional.