News for hackers. Stuff that matters.
Re:Why SQLite Does Not Use Git by specialist on Tuesday April 10, 2018 @11:17PM (#16807758)
“rebase” is just “pull before push”, right?

While I have no opinion on git, I can’t abide by all the precious chaotic mutant misuse, like git-flow.

I’d happily accept a subset of primitives, if only to disallow bad ideas. Kinda like Git vs SVN, C/C++ vs Java, flamethrower vs peanut butter.

Re:Why SQLite Does Not Use Git by aidenn0 on Wednesday April 11, 2018 @12:09AM (#16807961)
Rebase is "rewind local changes" "pull" "replay local chances"

Basically it makes it so that all of the local-only commits are sequenced after any remote changes that you have not seen yet.

[edit]

YZF is correct. In the context of pulling (i.e. "git pull --rebase") my description is correct. However in general rebasing branch X to Y that diverge from commit C is:

rewind branch Y to commit C; call the old tip of Y Y'

play all commits from C -> X on Y

play all commits from C -> Y' to branch Y.

Re:Why SQLite Does Not Use Git by YZF on Wednesday April 11, 2018 @12:14AM (#16807982)
You can rebase between two local branches. The rebase operation has nothing to do with pull or remote vs. local.
Re:Why SQLite Does Not Use Git by aidenn0 on Wednesday April 11, 2018 @01:23AM (#16808282)
Yes. I thought we were in the context of git pull --rebase...
Re:Why SQLite Does Not Use Git by e12e on Wednesday April 11, 2018 @02:06AM (#16808462)
"pull" might be the first thing I'd throw out, if thought there was any hope of fixing git ux. Then add a working merge --dry-run #do i have conflicts?.
Re:Why SQLite Does Not Use Git by aidenn0 on Wednesday April 11, 2018 @12:01PM (#16812467)
I think a default of --ff-only would be fine for pull. This is great for when I'm merely a consumer of a project, and will never silently perform a merge or rebase.
Re:Why SQLite Does Not Use Git by specialist on Wednesday April 11, 2018 @12:36PM (#16812838)
Thanks (all) for the clarifications.

When explaining to others, I should probably say 'pull, reapply, then push'.

Perhaps 'rebranch' is a better word choice than 'rebase', to conceptually more closely match what's actually happening under the hood.

Re:Why SQLite Does Not Use Git by joesb on Tuesday April 10, 2018 @11:26PM (#16807798)
"rebase" is not just "pull before push", though.

It's pull then rewrite all your personal commits to be based on the latest tip from that pull.

Re:Why SQLite Does Not Use Git by YZF on Wednesday April 11, 2018 @12:12AM (#16807972)
rebase is simply(tm) replaying a sequence of commits (or diffs or patches for that matter) over some arbitrary base, hence re-base ...
Re:Why SQLite Does Not Use Git by TomK32 on Wednesday April 11, 2018 @03:00AM (#16808712)
rebase can do a lot more. Try `git rebase -i` to squash smaller commits, edit the commit msg, or even drop a commit before you push it to your colleagues.

Last time our devop did 20 commits to get something on elasticbeanstalk right, I squashed it all into just one clean commit that got merged into master branch.

It will help you to commit more often without worry until the moment you have to hand in your work.

Re:Why SQLite Does Not Use Git by fulafel on Wednesday April 11, 2018 @12:01AM (#16807927)
Rebase is a controversial history altering operation and makes it easy to paint yourself into a corner and get weird error messages or wrong results. Its very different from pull/merge.
Re:Why SQLite Does Not Use Git by y2kenny on Wednesday April 11, 2018 @01:24AM (#16808288)
History altering is only controversial on things that are published. There is nothing wrong with reordering, combining or splitting your local commits to give more clarity to what you are doing. Keeping this in mine will give you the freedom to commit frequently.

This confusion happens because many popular SCMs historically have the "commit" and "push" operation in a single step. Git keep them separate.

Re:Why SQLite Does Not Use Git by fulafel on Wednesday April 11, 2018 @09:51AM (#16811036)
There is no tracking by git on what is published, so it's easy to make the mistake of rebasing things that are published and shared by others. Then you will have a bad time later when you try to sync with others, possibly days later.
Re:Why SQLite Does Not Use Git by y2kenny on Wednesday April 11, 2018 @10:35AM (#16811462)
Um... git kind of does with remote tracking branches. You can also make it very obvious by your workflow? If you use local feature branches (which you should for juggling between development tasks, etc.), what you are working on vs what's upstreamed should be pretty clear. Sounds like you are not using local branches.

Not using local branch is another confusion caused by the perspective of historical/traditional SCMs (people thinking branches are the domain of a centralized server and are outside of their control.)

Re:Why SQLite Does Not Use Git by fulafel on Wednesday April 11, 2018 @11:25AM (#16812074)
Often you want to push changes to a remote, but not yet merge or PR them to upstream.

Keeping "local feature branches" just on your dev machine is bad for many many reasons:

- you want to encourage low barrier cooperation in your team -> sharing changes

- you want changes to the CI pipeline early so the potentially slow testing machinery works in parallel with the developer

- you want to keep the team up to date on what changes you make

- you don't want to lose work if the machine/OS dies, or the developer leaves/becomes sick/goes on a 4 week vacation during which they forget their disk crypto password

So, in practice you can try to use rebase opportunistically, when out of chance your WIP work is still unpushed because the change was only made very recently. This is error prone. Or you can rebase published branches explicitly, by destroying the original branches in the PR merge phase. But all this is big bother if the purpouse is to just beautify history and at the same time hide the real trial and error that went into making the changes.

Re:Why SQLite Does Not Use Git by yawaramin on Saturday April 14, 2018 @03:30PM (#16838982)
Did you notice that y2kenny was talking about how, if you use local feature branches, then the remote tracking branches make it really clear what's been published vs not? The implicit meaning is that we should use local feature branches but also publish them to the repo while we're working on them.

But maybe to you, 'publish' means 'publish to master'? In that case I can assure you, they are not necessarily the same thing. I regularly work on a local feature branch, publish that branch to the shared repo, rebase it on top of master, then force-push to the shared tracking branch. When I'm done I merge it into master and don't rebase master on top of anything.

Re:Why SQLite Does Not Use Git by y2kenny on Wednesday April 11, 2018 @02:57PM (#16814300)
who said anything about not publishing?
Re:Why SQLite Does Not Use Git by fulafel on Thursday April 12, 2018 @12:07AM (#16817898)
I'm not sure if you are being serious? The answer is that published advice on rebase overwhelmingly warns against rebasing published code, and for good reason.
Re:Why SQLite Does Not Use Git by y2kenny on Thursday April 12, 2018 @12:58AM (#16818125)
Who said anything about rebasing published code?
Re:Why SQLite Does Not Use Git by TomK32 on Wednesday April 11, 2018 @02:55AM (#16808692)
I LOVE rebase but when I run into merge conflicts I rather `rebase --abort` and leave that merge commit as it is. But those instances are rare and having a merged branch's commits nice and compact in the log makes me happy every time.