-
-
Notifications
You must be signed in to change notification settings - Fork 2
Git tips and tricks
This page is a place to collect things we found out how to do in git
- Open git bash window
- git stash
- Usual process to create feature branch...checkout develop, rebase, start feature
- git stash pop
Usually your changes are there. If someone else modified the same files you will need to merge.
Todo: describe that process.
This is helpful if some non-flex repo is using git/gerrit, but the add-ons for git gui are not available.
(As usual, use "git branch feature/Name" to make a branch, git checkout feature/Name to start working on it, make some changes, and stage/commit them--I usually use Git gui for that.)
Finally:
git review develop feature/Name
(Replace feature/Name with the name of your branch, and if necessary "develop" with the name of the branch you are working from.)
There's an even more obscure syntax you can use if you haven't installed the git review extension.
Todo: describe how to install it.
Todo: describe how to push for review without it. It's something like git push refs/for/feature/Name refs/for/develop, but do NOT try that without checking. The refs/for part is right, you may be able to find it by googling that.
You just realized that you committed your changes to develop instead of a feature branch...
git log
Will produce something like
commit 72265073df3c23f860a27b076cf5b085c5a82aef
Author: John Thomson <[email protected]>
Date: Tue Aug 27 10:44:00 2013 -0500
LT-14852 Shorten keyboard control labels
You need to copy the SHA code (from the commit line above).
git branch feature/LT-14852
(Makes your feature branch...give it your own name, of course)
git rebase -p --onto feature/LT-14852 72265073df3c23f860a27b076cf5b085c5a82aef^ develop
(Replace feature/LT-14852 with the name of your feature, 72265073df3c23f860a27b076cf5b085c5a82aef with your SHA, and develop with the name of the branch you accidentally committed to...often develop will be right. Keep the "^" character at the end of the SHA.)
git checkout feature/LT-14852
At this point you can go into git gui and amend last commit and make sure everything is right.