(→Follow remote feature branch) |
|||
| Line 7: | Line 7: | ||
Run these commands before you even ponder ever in your life pushing to a Git repo. | Run these commands before you even ponder ever in your life pushing to a Git repo. | ||
| + | |||
| + | ''If you use the Emerge scripts for Windows get an error saying home is not set; then add an environment variable HOME with value %USERPROFILE% (which is replaced by your account folder automatically'' | ||
= Getting started with git = | = Getting started with git = | ||
| Line 70: | Line 72: | ||
*Create an account on [http://gitorious.org gitorious.org] the git hosting service used by Qt and now Amarok. | *Create an account on [http://gitorious.org gitorious.org] the git hosting service used by Qt and now Amarok. | ||
*On your user page, (that's at http://gitorious.org/~your_nick) click on "Manage SSH keys" and add your SSH key. | *On your user page, (that's at http://gitorious.org/~your_nick) click on "Manage SSH keys" and add your SSH key. | ||
| + | ''On Windows you will need to add an environment variable GIT_SSH with value plink.exe to automatically negotiate the SSH connection. plink should therefore be in your PATH. check [http://techbase.kde.org/Getting_Started/Build/KDE4/Windows/subversion Enable Pageant] for details.'' | ||
| − | People with KDE-SVN accounts | + | People with KDE-SVN accounts also should do the following: |
*Again from the user page, click on "Manage aliases" and add any email addresses you've ever used in KDE SVN. This way any commits you've made in the past are tracked back to you. If your gitorious email address is the only one you ever used, then this step isn't needed. | *Again from the user page, click on "Manage aliases" and add any email addresses you've ever used in KDE SVN. This way any commits you've made in the past are tracked back to you. If your gitorious email address is the only one you ever used, then this step isn't needed. | ||
Amarok is now developed in a Git repository instead of SVN. This was done to help get into place all the needed infrastructure to convert all of KDE, including documentation.
Contents |
git config --global user.name "Your Legal First and Last Name Here" git config --global user.email you@yourdomain.example.com
Run these commands before you even ponder ever in your life pushing to a Git repo.
If you use the Emerge scripts for Windows get an error saying home is not set; then add an environment variable HOME with value %USERPROFILE% (which is replaced by your account folder automatically
Depending on whether you simply want to test and follow Amarok development, write the occasional patch, or are an Amarok developer, the steps to use the repo are different.
git clone git://gitorious.org/amarok/amarok.git
This creates an 'amarok' directory. cd into that and use it like normal. And when you want to update:
git pull
will download the new changes.
You can use the method above, make your changes, then do 'git diff' to create a patch like normal. Or you could use the following rules to create your own fork of Amarok with the additions you would like to request to merge. This makes it easier for Amarok Developers to track your changes and is better for more complicated patches.
git clone git@gitorious.org:~yourname/amarok/yourname-clone.git
git branch my_feature_branch
git checkout my_feature_branch
...work on this checkout - follow the normal development workflow...
git commit -a
git push origin my_feature_branch
git remote add upstream git@gitorious.org:amarok/amarok.git
git pull --rebase upstream master
On Windows you will need to add an environment variable GIT_SSH with value plink.exe to automatically negotiate the SSH connection. plink should therefore be in your PATH. check Enable Pageant for details.
People with KDE-SVN accounts also should do the following:
Gitorious has one address for cloning, and another for pushing. The pushing address can be used for cloning, so the easy thing to do is just use that.
git clone git@gitorious.org:amarok/amarok.git
This will create a directory 'amarok'. cd into that and start developing!
90% of the time this is all that is needed:
git pull --rebase #hack, compile, build. It works! git status #to check if you want to commit all the modified files git commit -a git log git push
git pull --rebase downloads the latest changes. The --rebase option takes any unpushed local commits and applies them to the latest code, moving it to the top of the history. It is the equivalent of git pull; git rebase origin/master. See the "1. Rebase" section of Shipping Quality Code for a good explanation of what rebase does.
git status will tell you what files are modified. If you created a new file, use git add on it to "track" it. If there are some junk files, you can add a regexp to .gitignore in the root.
git commit -a will commit all unmodified files. You can use git add and then simply git commit instead if you wish to commit only certain files.
Use git log to review the local unpushed commits. Possibly also useful is git diff origin/master, which will give you a diff between the current checkout and what is in the central repo.
git push pushes all the local commits to the central repo.
With git, feature branches are cheap and easy. Here's how to follow a feature branch someone else has already setup.
Remember that you can't push to git:// URL's when picking what URL to use.
git remote add jeff git://gitorious.org/~jefferai/amarok/jefferai-work.git git remote update git branch -a git branch jeff-pud pud-action/pudaction-removal git checkout jeff-pud #and later you want to switch back to the mainline git checkout master
git remote add adds a new remote named 'jeff' with the given URL. Think of remotes like bookmarks: you could always just explicitly pull from a URL instead.
git remote update downloads all the remotes you have without merging them, including the remote you just defined. This is a handy command if you're tracking multiple remotes.
git branch -a this lists all the branches you have, including the remote branches. Find the new branch you want to look at.
git branch this command creates a local branch called 'jeff-pud' that tracks the remote branch 'pud-action/pudaction-removal'. You figured out the name of the latter in the previous command.
git checkout is how you switch between branches.