From: Francesco Rugiano 
  To: git-users@googlegroups.com 
  Sent: Sunday, December 23, 2012 8:57 PM
  Subject: [git-users] Keep local repo small


  Hello
  I have a question and i didn't manage to get an answer.
  I am in this situation:

  Remote repository - hosted on bitbucket
  Local repository on PC1 - managed by Git 1.8.0 (on Windows 7)
  Local repository on PC2 - managed by Git 1.8.0 (on Windows 7)

  Committs:
  (oldest) A->B->C->D->E (newest)

  I can, from both PCs, committ and/or revert to previous versions of the code. 
For instance, i can committ something on PC2 (committ F), sync both the pcs and 
the remote repo (so they all have the F committ) and then, from PC1, revert to 
committ E. I learnt how to do that.

  Now, in order to keep the local repositories small, i wanted to remove 
committs A, B and C. I wanted, however, to keep them on the remote repository, 
in order to be able to revert to them in the future.
Why do you need 'small'? and how small?  There are a few different reasons that 
may affect what you choose.
1. You have big different binary files in each commit - it is good to get rid 
of these - perhaps set a better gitignore file.
2. You have lots of small partial fixes, such as work in progress (WIP) commits 
- You should 'squash' the WIP commits using 'rebase -i', once you are satisfied 
with your branch. This will mean the new commit sequence moves steadily form 
one working code base to the next in small well explained steps - this is good.
3. You have a lot of steps in you development on big source files and are 
worried about storage - Don't. Git is very good at it's repository compression, 
so the 'many steps' will fit in a small space, and you will still have a better 
history.

  I mean having a situation like this:

  Remote repository - committs A->B->C->D->E
  Local repository on PC1 - committs D->E
  Local repository on PC2 - committs D->E

  Then, if PC2 committs something (after all the syncs):

  Remote repository - committs A->B->C->D->E->F
  Local repository on PC1 - committs D->E->F
  Local repository on PC2 - committs D->E->F

  Can i do this? if yes, how? if not, what are the alternatives?

  Thank you

-- 


Reply via email to