This page gives the essential Git commands for working with this project's source files.
Setting up repository for the first time
git clone --branch 8.2.x https://git.drupal.org/project/drupal.git
RoutinelyThe headings below are not sequential. What you choose to do depends on where you are in your process.
Checking your repository statusTo see what you will commit by running
git commitand what you could commit by running
git addbefore running
Switching to a different branchWhen you clone the repository you have access to all the branches and tags. The first command shows your choices. The second command makes the switch. See branching and tagging for details.
git branch -a
git checkout [branchname]
Getting ready to create or apply patchesIf you have not already cloned the repository, follow the directions above for setting up this repository in your local environment. Be sure you are on the branch you wish to patch, then ensure it is up-to-date with the following command:
git pull origin 8.2.x
Creating a patchFor most improvements, use the following command after making your changes:
git diff > [description]-[issue-number]-[comment-number].patch
Applying a patchDownload the patch to your working directory. Apply the patch with the following command:
git apply -v [patchname.patch]
When you're done: Reverting uncommited changesRevert changes to a specific file:
git checkout [filename]
git reset --hard