Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. 
like image 746
xeon111 Avatar asked Dec 24 '13 06:12

xeon111


People also ask

Why is commit history important?

As the project/repository evolves over time (new features getting added, bugs being fixed, architecture being refactored), commit messages are the place where one can see what was changed and how. So it's important that these messages reflect the underlying change in a short, precise manner.

What is Phabricator code review?

Code review in Phabricator is a lightweight, asynchronous web-based process. If you are familiar with GitHub, it is similar to how pull requests work: An author prepares a change to a codebase, then sends it for review. They specify who they want to review it (additional users may be notified as well, see below).

How do I revert a commit in Phabricator?

Phabricator is for reviewing code, not for editing it. It is not possible to make arbitrary changes to your repositories from the Phabricator UI. To do that, you need to go back to your client side tools - git revert and arc diff (or if you think a revert does not need reviewing; git push ).

What is commit history?

Commit history in Abstract is a log of commits that allows you to view the changes that have happened on every commit that has ever been made in a given branch, including the main branch.


2 Answers

asherkin's answer explains the rationale for this behavior, and why this is the default.

If you don't find that argument compelling, you can use the --merge flag to arc land to perform --no-ff merges instead of --squash merges. These merges will not destroy local commits.

If you set history.immutable to true in your .arcconfig, arc land will --no-ff merge by default.

You can also use raw git commands if you don't like the behavior of arc land; it is provided only for convenience.

In your example, we recommend creating five separate reviews -- there are multiple different ideas being implemented, and they are not related and seem easily separable. See Writing Reviewable Code. Combining bugfixes, style changes and new features into one change is hoarding.

like image 109
Evan Priestley Avatar answered Sep 29 '22 11:09

Evan Priestley


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.

like image 30
mockinterface Avatar answered Sep 29 '22 11:09

mockinterface