There are a few ways to set up a Git "central" server, as described in the FAQ, mainly via git-daemon, over HTTP or via an existing SSH server (if it's on a Linux box, you can share a repository by setting unix groups appropriately and giving group permissions). Alternatively, you can use existing services like GitHub.
If you want to push a number of local commits as a single commit, you can "squash" those commits, with git merge
or git rebase -i
(interactive). I find it easier to do with git rebase -i
. You need to give a hash or identifier for a previous commit (from which you may want to merge) as an argument. Then, you'll get a editor with something like this:
pick 0000001 Fixed big bug 1
pick a000002 Fixed big bug 2
pick dae3124 Fixed big bug 3
pick 3554abc Fixed big bug 4
# Rebase 5cea2cd..8963229 onto 5cea2cd
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
#
# If you remove a line here THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.
#
You can then edit this file to have something like this:
pick 0000001 Fixed big bug 1
squash a000002 Fixed big bug 2
squash dae3124 Fixed big bug 3
pick 3554abc Fixed big bug 4
Once you save the file, Git will offer you to edit the log messages of the commits you squash into one message. Effectively, you'll have merged 0000001, a000002 and dae3124 into "Fixed big bugs 1, 2 and 3." for example. (You could use fixup
too.) You log will then be:
0014234 Fixed big bugs 1, 2 and 3.
3554abc Fixed big bug 4
(Of course, the result hash of the merged commit will look nothing like the hashes of the commits it comes from.)
Once you've done that locally, you can push that branch to the remote public repository.