Changes

Jump to navigation Jump to search

Git tips

452 bytes added, 21:53, 13 February 2011
=== How to push changes ===
The important thing to realize is that when pushing changes to the remote server (aka "''origin''"), your changes '''''must''''' be based on the remote repository's branch you wish to push to. Subversion allowed you, in some cases, to commit without having the most up-to-date working copy. Git doesn't.
A normal ''git push'' without any errors is one that only adds new commits, that (in their metadata) point to existing commits.
* '''git pull''' — Perform a ''fetch'' followed by a ''merge'' (the default behavior) or ''rebase'' (with a flag).
So in our case, if we made a few unrelated commits, we just want to apply them on top of the remote commits, and to do that we can use <tt>git pull --rebase</tt> which will get the remote changes, and reapply our local changes on top of the remote's. From that state, we could run <tt>gitk</tt> or any other visualization tool, see that everything is to our liking, and <tt>git push</tt> our changes back up. ==== Configuring <tt>git pull</tt> to rebase automatically ==== If you like making commits on the master branch, and want <tt>git pull</tt> to always rebase your local changes on top of the fetched commits, run this configuration command to modify the repository's <tt>.git/config</tt> file:  $ git config branch.master.rebase true
=== Branchy development ===
TODO
67

edits

Navigation menu