just a logo :)



Git Origins
Entry Nr. 3282, by user 1


git clone https://github.com/[username]/[repository]

Cloning will automatically set the original repo as the remote with the name 'origin'.


When multiple users push to a repo, permission problems can arise. Creating the repo via
git init --shared repoName
might solve that.

If the repo already exists, this will make sure new files will have the right group:
chmod -R g+s refs/ objects/

Allow pushing to a non-bare repo:
git config receive.denyCurrentBranch ignore
From git 2.3 on this is supported:
git config receive.denyCurrentBranch updateInstead


git add -A; git commit -m "I did some changes";git push https://github.com/[username]/[repository]

Pushing will not update the working directory. To do so, you have to run this command in the working directory of the remote repo: git reset --hard. An alternative would be git checkout -f master (If master is the current branch).


git pull https://github.com/[username]/[repository]

Add a remote

git remote add someRemote /path/to/some/repo/

Fetch from a remote

git fetch someRemote

What changed in the remote?

git log master..someRemote/master

I use this to see the oldest new commits first and see what changed:

git log -p --reverse master..c-af/master


When one of fetched commits is alright and you want to merge it into your repo:

git rebase <hash_of_the_commit>

(git commit would also work but cause merge commits)