Skip to content

Update patches page #916

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 16, 2011
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions contributing/code/patches.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,29 @@ Set up your user information with your real name and a working email address:
If you are new to Git, we highly recommend you to read the excellent and
free `ProGit`_ book.

.. tip::

Windows users: when installing Git, the installer will ask what to do with
line endings and suggests to replace all Lf by CRLF. This is the wrong
setting if you wish to contribute to Symfony! Selecting the as-is method is
your best choice, as git will convert your line feeds to the ones in the
repository. If you have already installed Git, you can check the value of
this setting by typing:

.. code-block:: bash

$ git config core.autocrlf
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it actually possible to put code blocks in tips?


This will return either "false", "input" or "true", "true" and "false" being
the wrong values. Set it to another value by typing:

.. code-block:: bash

$ git config --global core.autocrlf input

Replace --global by --local if you want to set it only for the active
repository
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the recommended value is input to avoid committing files using CRLF (the Symfony CS require using LF as line endings). By putting it to false, you need to check manually if your new files are using LF as git won't convert it for you


Get the Symfony2 source code:

* Create a `GitHub`_ account and sign in;
Expand Down Expand Up @@ -132,6 +155,11 @@ Create the topic branch with the following command:

$ git checkout -b BRANCH_NAME master

.. tip::

Replace "master" by, for example, 2.0, if you wish to submit a patch to the
2.0 branch.

.. tip::

Use a descriptive name for your branch (`ticket_XXX` where `XXX` is the
Expand Down Expand Up @@ -215,6 +243,35 @@ with master, don't merge; and force the push to the origin:
$ git rebase -f upstream/master
$ git push -f origin BRANCH_NAME

.. note::

when doing a push -f (or --force), always specify the branch name explicitly
to avoid messing other branches in the repo (--force tells git that you
really want to mess with things so do it carefully).

Often, moderators will ask you to "squash" your commits. This means you will
convert many commits to one commit. To do this, use the rebase command:

.. code-block:: bash

$ git rebase -i head~3
$ git push -f origin BRANCH_NAME
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should add a note about the force push saying that you should always specify the branch name explicitly when doing so to avoid messing other branches in the repo (--force tells git that you really want to mess things so do it carefully)


The number 3 here must equal the amount of commits in your branch. After you
type this command, an editor will popup showing a list of commits:

.. code-block:: text

pick 1a31be6 first commit
pick 7fc64b4 second commit
pick 7d33018 third commit

To squash all commits into the first one, remove the word "pick" before the
second and the last commits, and replace it by the word "squash" or just "s".
When you save, git will start rebasing, and if succesful, will ask you to edit
the commit message, which by default is a listing of the commit messages of all
the commits. When you finish, execute the push command.

.. note::

All patches you are going to submit must be released under the MIT
Expand Down