Committing changes to Git
Totally incomplete, but we have to start somewhere. Please contribute!
UNDER CONSTRUCTION, INSTRUCTIONS ARE NOT COMPLETE OR EVEN GUARANTEED TO WORK
Disclaimer Currently, we're still working out the preferred way of committing to Git, so this page is definitely a "work in progress". If you're a seasoned Git pro do not feel that what's written here is a requirement, but do please look it over and see if it's reasonably compatible.
There's been a lot of discussion about how to commit to the Git repo since we moved to using Git in early 2016. This page is intended for people new to Git or Lucene/Solr as a place to start. If you're totally new to Git or if you're a new committer, this should get you started.
- Only committers have the ability to commit to the official Git repository.
- IntelliJ and Eclipse have built-in Git integration
- There are visual tools that may be used as well. Mention here is not an endorsement, nor is it a complete list.
There are about a zillion "how to use Git" links out there, here are a few links that are useful in this context. Except for Dawid's and Apache's pages, these are not associated with this project.
Git at Apache General Apache guidelines.
Dawid's guide From our very own Dawid Weiss.
Git for SVN crash course For people who know SVN but not Git.
Let Me Google That For You I've wanted to paste a link to LMGTFY for a long time...
The goal here is to provide a super-simple guide without getting off into the all the possibilities, and it will certainly seem "too simple" to sophisticated users. We all have to start somewhere.
Here are some recommended defaults to configure Globally for Git:
git config [--global] user.name <real-name> git config [--global] user.email <email>@apache.org #Is this really recommended? git config --global pull.rebase true
For simple commits for simple JIRAs for simple people, here are a few ways of going about it.
update your repo (perhaps with .gitconfig making this use rebasing)
- git checkout origin/master
Make changes, get through ant precommit and ant test targets
- git add
- git commit -m "SOLR-#### additional comments, often the title of the JIRA" (commits locally, nothing in ASF yet)
- git pull
- git push
at any time git status tells you whether you have anything local that isn't in sync with the branch you're on. This includes changes not committed locally, new files not added to the local repository.
git diff --stat origin/master.. will show you committed (locally) but not pushed changes
If you omit the -m flag you'll find yourself in a vi-like editor where you can enter long commit messages.
Anyone want to volunteer to add something here?
Backporting changes from trunk to 5x (6x sometime soon)
The usual recommendation is to "cherry pick".
- git checkout branch-5x
- git cherry-pick hash (You should have seen the hash echoed when you committed to origin/master, if not and you included the SOLR-####, the JIRA will have it)
Check patch, perhaps run ant precommit and ant test targets again
- git commit (note this _may_ already preserve the comments from the hash you're cherry-picking from)
- git push
There has been some issue with Solr's CHANGES.txt file "cherry picking" all of the changes for trunk, so check this file especially
Add patches to JIRA tickets or not?
what is the consensus here?
More sophisticated options for more sophisticated people
Hey, Git Pros! Feel free to add information here.
Dawid's Git Page Lots of options here, a fine way to get more sophisticated in your use of Git.
- At least one problem with IntelliJ (Community edition, version 15) is that it seems to get confused if you have both the SVN and Git plugins active at once. My (Erick Erickson) issues cleared up when I disabled the svn plugin.