xeon111 xeon111 - 1 month ago 9
Git Question

How to prevent phabricator from eating my commit history

Here is the scenario that is pretty much annoying me.

Jack works in foobar a software house, Jack is a Working Programmer, he loves coding and commits frequently. Paul who is jack's manager tells him that we are going to start using a new code review tool, phabricator. Jack complies, Jack creates a local branch and starts working. He adds features and commits to his local branch very frequently. Now at the end of the day he sends a phabricator request.

arc diff development


John who is jacks team member reviews his code and accepts his changes.
Now Jack opens the terminal and moves to his repository directory.
Jack types the following command to close the revision and merge his code with the development branch.

arc land --onto development


He sees the following message

Landing current branch 'feature-awesome-features'.
Switched to branch development. Updating branch...
The following commit(s) will be landed:

b2ff76e Added the foo to bar
33f33ba Added a really important check which can destroy the project or save it
31a4c9a Added that new awesome feature
8cae3bf rewrote that awful code john wrote
bc54afb bug fixes

Switched to branch feature-awesome-features. Identifying and merging...
Landing revision 'D1067: Added the awesome feature'...
Rebasing feature-awesome-features onto development
Already up-to-date.
Pushing change...


Now jack opens Github to see his code , his beautiful commits. but what he sees is pure horror all of his commits have been replaced by a single commit which basically says something like this

Summary: Added the awesome feature

Test Plan: do foo bar testing

Reviewers: John

Reviewed By: John

CC: Paul

Differential Revision: http://phabricator.foobar.com/D1067


Now jack is sad, because he wants to see all of his commits, jack thinks that this commit makes him look like The Hoarder which he is not. He wants to fix this so he goes to ask a question on stackoverflow.

That how may he prevent phabricator from eating his commit history.

Answer

You should use the native git flow such as git merge and git push directly instead. From phabricator arc documentation:

After changes have been accepted, you generally push them and close the revision. arc has several workflows which help with this, by:

* squashing or merging changes from a feature branch into a master branch
* formatting a good commit message with all the information from Differential
* and automatically closing the revision.

You don't need to use any of these workflows: you can just run git push, hg push or svn commit and then manually close the revision from the web.

arc is squashing your commits on purpose.