Page History
...
git status
- At any time, you may use this command to determine the status of your local git repository and how many commits ahead or behind it may be from the "origin" repository at GitHub. It also tells you if you have local changes that you haven't yet committed. For more info type:git help status
git log
- At any time, you may use this command to see a log of recent commits you've made to the current branch. For more info type:git help log
git diff
- At any time, you may use this command to see differences of your current in progress work. For more info type:git help diff
git pull
- Can be used instead of usinggit fetch
followed bygit merge
. A "pull" does both a fetch and an automated "merge" in a single step.git stash
(See also: Stashing) - Allows you to temporarily "stash" uncommitted changes. This command is extremely useful if you want to do a "pull" or "merge" but were working on something else. You can temporarily "stash" what you are working on to perform the merge/pull, and then usegit stash apply
to reapply your stashed work.git rebase
(See also: Rebasing) - This tool is extremely powerful, and can be used to reorganize or combine commits that have been made on a local branch. It can also be used in place of a "merge" (in any of the situations described above). However, as it changes your commit history, you should NEVER USE REBASE ON ANY BRANCH THAT HAS BEEN PUBLICLY SHARED ON GITHUB. For more information, see Pro-Git's chapter on Rebasing and GitHub's 'rebase' page.- git cherry-pick - useful to grab a single commit into current branch from any of the local branches or remote branches added locally. A handy use-case is when we have a master branch and a bugfix branch (e.g. dspace-34_x) and you want a bugfix to go to both branches, you can commit to either branch, then switch to the other and execute "git cherry-pick [commit-hash]". Don't forget to push both branches, as usual. For details, see Getting a commit to multiple branches (backporting)
...
- the "master" branch (in order for it to appear in the next major DSpace release)
- the release branch, e.g. "dspace-34_x" (in order for it to appear in the next minor DSpace release)
...
First, make sure you have the release branch (e.g. 'dspace-34_x') set up correctly in your local repo. It needs to be setup to "track" the branch in the "upstream" repo
Code Block # run one time only, to get the branch to your local repo. git checkout --track -b dspace-34_x upstream/dspace-34_x
- Create a Pull Request for the "master" branch. The easiest way to do this is to create it via GitHub.
- After your Pull Request has been reviewed and approved, make sure it is merged into the "master" branch. The merger will result in two separate commits - the original change itself and the merge commit. Make sure you know the hash of the original commit.
- Use git cherry-pick to add the original commit to the release branch:
Code Block |
---|
# Make sure you are on your release branch (e.g. dspace-34_x) git checkout dspace-34_x # If you just merged to upstream/master, fetch the list of latest revisions from the upstream repo. not needed if you have the commit anywhere in the local repo. git fetch upstream # This is the hash of the original commit git cherry-pick abc123def456 # check that it's correct git log # Finally, push from your local repo to the upstream repo branch git push upstream dspace-34_x |
Common DSpace Git/GitHub Issues
...
Overview
Content Tools