A small hook meant to be installed on a remote git repo. The hook is a post update hook and sould be run by the remote repo each time somebody successfully pushes to the repo. It will create a directory called master and check out the remote repo into this and make sure to pull […]
Archive for the ‘GIT’ Category
keep a checked out version of master updated via hook on a remote server – The JACK hook
By thomas in GITrunning a bash script from windows command using bash installed by git for windows
By thomas in GIT, Windowsfrom a windows command navigated to git bin folder one can execute: bash.exe –login -i to start a nice shell if this line is given another parameter its assumed to be a script file which is executed. Additional arguments are passed to the script file as arguments. bash.exe –login -i “myscript.sh” “arguments”
setting up git mergetool on windows
By thomas in GIT, WindowsOne possible merge tool for windows is kdiff3 which works great. after installing kdiff3 git needs to be set up. This blog post describes it (http://www.blog.project13.pl/index.php/coding/1192/setup-git-on-windows-to-use-kdiff3-as-its-mergetool/) but its repeated here: add the following to .gitconfig [merge] tool=kdiff3 [mergetool “kdiff3”] path = C:/Program Files/KDiff3/kdiff3.exe keepBackup = false trustExitCode = false
Tags: .gitconfig, git mergetool, kdiff3
push all submodules in a git repo
By thomas in GITIf you have a git repository that consist of several submodules you can push all submodules by doing the following: place yourself in the main git repo. write: git submodule foreach git push To make sure that you get through all the submodules even if errors occurs do: git submodule foreach “git push || true”
Tags: foreach, git, submodules
git revert only one file that has not been committed
By thomas in GITYou have made changes to a file that you realize was wrong (eg. overrige a file’s content) and you want to revert it to the latest comitted version: git checkout <filename> If you have a branch with the same name you need to do: git checkout — <filename> source: http://norbauer.com/notebooks/code/notes/git-revert-reset-a-single-file
merging when git conflict – setup and tools
By thomas in GITPossible merge tools: kdiff3 and meld Setup kdiff3 in git git config –global difftool.prompt false git config –global difftool.kdiff3.trustExitCode false git config –global diff.tool kdiff3 git config –global mergetool.kdiff3.trustExitCode false git config –global mergetool.keepBackup false git config –global merge.tool kdiff3 When forming a merge command the following variables can be used (This should however not […]
Tags: git, git diff, git difftool, git merge, git mergetool, kdiff3, meld
Git: adding and removing branches from remote repositories
By thomas in GITYou can add a branch to a remote repository by git push origin <branchname> and you can remove this branch again by typing git push origin :<branchname> so prepending a :
Git Correct commit pushed to remote repository
By thomas in GITIf you have pushed something to a remote repository that should not have been pushed then do the following: checkout locally the commit that you want to replace the erroneous commit (this should be a commit at an earlier stage than the unwanted one) git push -f origin master this will force the remote repository to be […]
rebase in GIT
By thomas in GITgit rebase is a great way to clean up the history adding a -i like git rebase -i enters interactive mode and directs you to a file that let you control what commits are added.
Git stage lines causes corrupt patch
By thomas in GITAfter making changes you may want to split these changes up into several commits but some of the changes may be in the same file. If you then use git-gui to stage different lines in one file and the last line in this file is part of the diff from HEAD then git-gui will produce […]