I have a super slow connection right now, and I need to push a new branch into my company's git server. With SVN, I am able to commit/push files to a remote SVN server one at a time if I'd like. In the past, when I had a slow connection, I was able to upload a folder at a time and it worked great. I sure could use something similar in git.
When you do a git-push(1), the manual says:
The
<src>
is often the name of the branch you would want to push, but it can be any arbitrary "SHA-1 expression", such as master~4 or HEAD (see gitrevisions(7)).
As a result, you should be able to push individual commits up to the remote by organizing them in chronological order, and then specifying each one in a detailed refspec. For example:
# Get all commits not in remotes/origin/master and
# sort in chronological order.
commits_list=$(
git log --oneline --reverse refs/remotes/origin/master..HEAD |
awk '{print $1}'
)
# Push each commit one-by-one to origin/master.
for commit in $commits_list; do
git push origin $commit:refs/heads/master
done
I tested this locally, and it seems to work as intended. Give it a try; if nothing else, it will get you pointed in the right direction.