Set up a git environment with for two desktops sharing source code through USB
Warning : all those commands have to be tested before use. Check git documentation for more explanations.
git env creation on USB Key
using git-bash, in the repository folder do
$ git --bare init
git env creation on one desktop
using git-bash, in the source folder do
$ git init
manage ignored ressourcescreate a .gitignore
$ git add .gitignore
$ git commit -m "ignored resource"
avoid conversion from LF to CRLF $ git config core.autocrlf false
$ git config --global user.name "yourName"
$ git config --global user.email yourEmail
commit your existing sources$ git add --all
$ git commit -m "initial commit"
Add a remote repository (assuming the drive is f)
$ git remote add origin /f/path/to/repo/
Push sources
$ git push origin master
On the second desktop
using git-bash, in the source folder do$ git init
$ git remote add origin /f/path/to/repo/
pull sources
$ git pull origin master
Tips
if you want to overide local changes
$ git fetch origin master
$ git reset --hard FETCH_HEAD
at this point local untrack file and dir still exists (see git clean)
No comments:
Post a Comment