You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 5
Next »
Table of Contents
|
A simple cheat sheet for Fedora developers new to Git.
You can run git status at any time to get a snapshot of your current state. You can also examine your differences with the master branch on github at any time by executing these two commands:
git fetch origin master
git diff origin master
Creating and working with a published branch
- Get the repository:
git clone git@github.com:fcrepo/fcrepo.git
cd fcrepo
- Create the branch where you'll do your work:
git branch fcrepo-780
git checkout fcrepo-780
The checkout command makes whatever branch you specify the local active branch. Make your changes, test...
- Add your edited/new files, then commit your branch:
git add myfile.java
git commit myfile.java
- Push the branch back up to github
git push origin fcrepo-780
- Merge the branch into master (formerly known as 'trunk')
git checkout master
git merge fcrepo-780
Resolve any conflicts, and test again.
If any time has passed since you cloned master from github and merged your branch into your local copy of master, make sure that you also merge any upstream changes to master into your local copy:
Examine the changes:
then:
(The command git pull does a combined fetch-and-merge, but read this on why that's a bad idea.)
Merges are automatically committed locally.
- Update master on github:
- Once you've received word that the build has completed correctly, delete the branch
git push origin :fcrepo-780
Creating and working with an unpublished branch (with git rebase)
- Get the repository:
git clone git@github.com:fcrepo/fcrepo.git
cd fcrepo
- Create the branch where you'll do your work:
git branch fcrepo-780
git checkout fcrepo-780
The checkout command makes whatever branch you specify the local active branch. Make your changes, test...
- Add your edited/new files, then commit your branch:
git add myfile.java
git commit myfile.java
- Graft your changes (and commit histories) onto the end of master:
You may need resolve conflicts, then re-add and re-commit the merged files. If this is the case, you can pick up where you left off with the command
git rebase --continue .
The command git rebase -i master allows you to interactively edit, suppress, combine the commits in your branch, to eliminate non-useful or trivial commit messages in the final result.
- Switch to the master branch, update it to the latest version:
git checkout master
git pull
- Merge in the changes from your unpublished, rebased branch:
Merges are automatically committed locally.
- Update master on github:
|
#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))