When doing a ‘git push’, what does ‘–set-upstream’ do?

To avoid confusion, recent versions of git deprecate this somewhat ambiguous –set-upstream option in favor of a more verbose –set-upstream-to option with identical syntax and behavior. [ Reference ] git branch –set-upstream-to <remote-branch> sets the default remote branch for the current local branch. Any future git pull command (with the current local branch checked-out), will … Read more

How to specify which SSH key to use within git for git push in order to have gitorious as a mirror?

The answer is to be found in the git reference manual. GIT_SSH If this environment variable is set then git fetch and git push will use this command instead of ssh when they need to connect to a remote system. The $GIT_SSH command will be given exactly two arguments: the username@host (or just host) from … Read more

Images corrupt after git push

I had this issue too – here’s a generic .gitattributes that looks generally safe for php web repos that worked for me: https://github.com/Danimoth/gitattributes/blob/master/Web.gitattributes running git check-attr –all — path/to/png before and after adding the new gitattributes showed that the image file was originally treated as a text file, and now it’s binary (note I had … Read more

What does GIT PUSH do exactly?

Assuming you already understand git’s “objects” model (your commits and files and so on are all just “objects in the git database”, with “loose” objects—those not packed up to save space—stored in .git/objects/12/34567… and the like)… You are correct: git fetch retrieves objects “they” (origin, in this case) have that you don’t, and sticks labels … Read more

Git merge flattening

“git merge –squash” (after “git fetch”; “git pull” is just fetch+merge, pehaps it also allows –squash option) might be what you want. From git-merge(1): –squash Produce the working tree and index state as if a real merge happened, but do not actually make a commit or move the HEAD, nor record $GIT_DIR/MERGE_HEAD to cause the … Read more

Force push current branch

You can use aliases to shorten the command. Use it like this: git config –global alias.fpush “push –force origin” Now to push your branch just type: git fpush feature-mongodb-support Or you can even hardcode the branch name into the command: git alias fpush “push –force origin feature-mongodb-support” and use only git fpush to push your … Read more

How to commit to remote git repository

All You have to do is git push origin master, where origin is the default name (alias) of Your remote repository and master is the remote branch You want to push Your changes to. You may also want to check these out: http://gitimmersion.com/ http://progit.org/book/