A little lost setting up my git starting state - I'm sure it's just a couple simple commands, but -


context:

  • user "dev", home directory /home/dev
  • production code in i'll call /thepath/codebase
  • working directory /thepath/dev (currently files should branch)
  • project called kizunadb

ultimately want bare repo called kizunadb.git somewhere (i guess home directory logical) want seen "original", clones from. (per conclusions this discussion)

not knowing how start empty bare repo , put files elsewhere, tried starting files are. made repo in /thepath/codebase , committed files. did:

cd ~ mkdir kizunadb.git cd kizunadb.git git clone --bare /thepath/codebase 

hmm... made /home/dev/kizunadb.git/codebase.git - not quite had in mind.

  1. i can again /home/dev/ fix location, still called codebase.git - if change name, break it?
  2. and how swap roles between , codebase directory later can completed code from kizunadb.git to /thepath/codebase (with clone or checkout - not sure right command @ point)? know git doesn't have concept of "the main one", have noticed references in tutorials "original" - not sure how plays in...
  3. and then, how clone repo /thepath/dev can branches without losing work in progress? (i know move whole directory out of way, clone repo, , overwrite repo's files, suspect there easier way.)

i'm happy start on if have done things in wrong order.

first, work better:

cd ~ git clone --bare /thepath/codebase kizunadb.git 

second, bare repo contributor push to.

but initialize bare repo codebase content, rather follow workflow describe in "fetch --all” in git bare repository doesn't synchronize local branches remote ones":

cd /thepath/codebase git clone --mirror . ~/kizunadb.git git push ~/kizunadb.git --mirror  

it can completed post-receive hook in order cd second non-bare repo , pull bare repo: see more @ "is --bare option equal core.bare config in git?".
supposes /thepath/codebase git repo.

/thepath/dev simple clone of bare repo kizunadb.git, develop in.

git stash allow make branch without losing work in progress.
see "git: commit changes old/safe branch while in new/dirty/dev branch without checking out or losing unstaged data".


as mention in comments, single developer, bare repo might superfluous.
could:

  • have one repo: /thepath/dev
  • use "git --git-dir=/thepath/dev/.git --work-tree=/thepath/codebase checkout -f" whenever want deploy code.

in case, /thepath/codebase wouldn't git repo, tree considered working directory /thepath/dev on deployment.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -