Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: git cherry-pick

...

  • 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 using git fetch followed by git 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 use git 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-3_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.
GitHub tips

If you want to show someone the diff between two commits, you can do it directly using GitHub functionality. Example:

...