Version control on a 2GB USB drive

前端 未结 14 1856
南笙
南笙 2020-12-07 11:30

For my school work, I do a lot of switching computers (from labs to my laptop to the library). I\'d kind of like to put this code under some kind of version control. Of co

14条回答
  •  抹茶落季
    2020-12-07 11:59

    I do this with Git. Simply, create a Git repository of your directory:

    git-init
    git add .
    git commit -m "Done"
    

    Insert the stick, cd to directory on it (I have a big ext2 file I mount with -o loop), and do:

    git-clone --bare /path/to/my/dir
    

    Then, I take the stick to other computer (home, etc.). I can work directly on stick, or clone once again. Go to some dir on the hard disk and:

    git-clone /path/to/stick/repos
    

    When I'm done with changes, I do 'git push' back to stick, and when I'm back at work, I 'git push' once again to move the changes from stick to work computer. Once you set this up, you can use 'git pull' to fetch the changes only (you don't need to clone anymore, just the first time) and 'git push' to push the changes the other way.

    The beauty of this is that you can see all the changes with 'git log' and even keep some unrelated work in sync when it changes at both places in the meantime.

    If you don't like the command line, you can use graphical tools like gitk and git-gui.

提交回复
热议问题