|
|
(30 intermediate revisions by 4 users not shown) |
Line 1: |
Line 1: |
| = Workflow recommendation =
| |
| # Keep a local master branch which only is a pointer to the gitorious master (does not contain local changes)
| |
| # Make development modification in a local branch
| |
| # When getting ready to push these changes to the origin try the following
| |
| ## Do a git pull on master to fetch and merge all changes from gitorious
| |
| ### '''git checkout master'''
| |
| ### '''git pull origin master'''
| |
| ## Do a git rebase of the topic branch onto master - That is with topic checkout do "git rebase master"
| |
| ### '''git rebase master topic'''
| |
| ## Fix any conflicts that result
| |
| ### Edit files
| |
| ### '''git add -u'''
| |
| ### '''git rebase --continue'''
| |
| ## Merge the topic branch - This will result in an fast-forward merge.
| |
| ### '''git merge topic'''
| |
| ## git push your local master branch
| |
| ### '''git push origin master'''
| |
| # If for some reason you have ever pushed your development branch to someone else don't rebase it as this is effectively rewriting history
| |
| # If you want to keep a record that your local development was made in parallel to some other development, do a git merge instead of git rebase in step 2 of above
| |
|
| |
|
| = Create a checkout =
| |
| * git clone git://gitorious.org/tubetk/tubetk.git
| |
|
| |
|
| |
| = Stash local changes temporarily =
| |
| * git stash
| |
|
| |
| = Create a local branch =
| |
| * git branch test
| |
|
| |
| = Swtich to a local branch =
| |
| * git checkout test
| |
|
| |
| = Get stashed local changes =
| |
| * git stash pop
| |
|
| |
| = Update a branch to the remote master's head =
| |
| * git stash
| |
| * git rebase origin master
| |
| * git stash pop
| |
|
| |
| = Add to local commit =
| |
| * git add <filename>
| |
| * git add -A
| |
|
| |
| = Push local commit =
| |
| * git push origin master
| |
|
| |
| = Remove a local branch =
| |
| * git checkout master
| |
| * git branch -d <branch>
| |
|
| |
| = Track a remote branch =
| |
| * "git fetch" (get up to date) or "git pull"
| |
| * git branch --track somebranch origin/somebranch
| |
| ** --track is not needed unless you've set branch.autosetupmerge to false in your config
| |
| * git checkout somebranch
| |
| * git commit
| |
| * git push
| |
| ** sends changes to origin/somebranch
| |
|
| |
| = Delete a remote branch =
| |
| * Don't do this unless you're incredibly confident in what you're doing
| |
| * git push origin :somebranch
| |
|
| |
| = Project History =
| |
| * git log ( To view the history of your changes )
| |
| * git log -p ( To see complete diffs at each step )
| |
| * git log --stat --summary ( To see overview )
| |
|
| |
| = Three ways to commit to remote/master =
| |
| # Without branching ( Good for quick changes )
| |
| # Branching and merging
| |
| # Branching and rebasing
| |
| = Additional References =
| |
| * GIT tutorial [http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html]
| |
|
| |
| = Setting up tracked repositories to start pushing =
| |
| #If you have cloned read-only version, do the following first
| |
| ## git remote rm origin
| |
| # Add the proper remote
| |
| ##git remote add origin git@gitorious.org:tubetk/tubetk.git
| |
| # You can push your changes
| |
| ##git push origin master
| |
|
| |
| git://gitorious.org/tubetk/tubetk.git
| |