git diff master origin/master
git reset --hard; git pull -Xtheirs
Useful if you have local changes that you do no longer need.
This will ignore the file on all commits using the -a argument.
git update-index --assume-unchanged [file]
To include the file in commites again use:
git update-index --no-assume-unchanged [file]
This is particularly handy when making local changes to a config file that must not enter the central repository.
git status
git ls-files
git ls-files -d
git checkout filename
git ls-files -d | xargs git checkout --
filename
will have merge conflicts marked in the same way used in CVS.
git add filename
marks the conflict as resolved.
git --no-pager [command]
Run
alias git='git --no-pager'
to disable it on all commands in the current shell.
Alternatively set core.pager =
in .gitconfig (it is set to the empty string.) to disable it entirely for that user.
# create tag locally: git tag -a v1.4 -m 'version 1.4' # push tag to server: git push –-tags
All:
git tag
Or filtered:
git tag -l v1.*
git show v1.4
# delete tag locally: git tag -d v1.0 # push tag deletion to origin: git push origin :refs/tags/v1.0
git branch
Create and switch to:
git checkout -b [branchname]
Just create:
git branch [branchname]
Push to server:
git push -u origin [branchname]
git checkout [branchname]
git branch -d branchname git push origin --delete branchname
git fetch --all
git cvsimport -k -i -d server:/path/to/CVSHOME -C git_reponame cvs_reponame
The resulting git_reponame directory now contains the .git folder which can be moved to a server location for shared access.
Run git update-server-info
in the new server folder in order to make it shareable.
As root: mkdir /home/git/repos/[reponame].git cd /home/git/repos/[reponame].git git --bare init git update-server-info chown -R apache:apache /home/git/repos/[repomame].git
Now clone the project on a client, add some files and commit them. When pushing them for the first time use the following command:
git push origin master
NOTE: If this is done by the usual 'git push' command, a 'No refs in common and none specified; doing nothing.' error will be issued.
From: https://help.github.com/articles/duplicating-a-repository/
# Create a bare clone of the repository. git clone --bare https://github.com/exampleuser/old-repository.git # Mirror-push to the new repository. cd old-repository.git git push --mirror https://github.com/exampleuser/new-repository.git
https://help.github.com/articles/changing-author-info/
NOTE: The way the push command is performed is important in order to overwrite bot commits and tags.