Differences between revisions 9 and 10
Revision 9 as of 2018-01-11 01:59:11
Size: 1498
Editor: PieterSmit
Comment:
Revision 10 as of 2018-02-24 22:07:16
Size: 1950
Editor: PieterSmit
Comment: Manage homedir
Deletions are marked like this. Additions are marked like this.
Line 38: Line 38:

== Manage homedir on new server from existing git repo ==
 * Setup repo, with no-checkou
   {{{ git clone --depth 2 --no-checkout repo-to-clone . }}}
 * Create a branch to keep current files local
   {{{
git branch original_201802
git checkout original_201802
git add .
git commit
   }}}
 * switch back to main branch
   {{{ git checkout dev }}}
 * Merge original file back into dev if required.
   {{{ git merge original-201802 }}}

Git

How to setup GIT private server

  1. Log into server, create git account, set it to use git-shell (no login), add .ssh/authorized keys for access with no password.
  2. Create repo with $ git init --bare repository

1. On client edit

  • --bare can't be used
  • Setup .ssh/config, see example if using port, and can even use specific port.
    • Host githost
      HostName git.host.de
      Port 4019
      User git
  1. On client pc clone with $ git clone githost:repository

  2. #(edit some files
  3. git commit -a # Commit all changes to the local version of the repository

  4. git push origin master # Push changes to the server's version of the repository

Nice Git prompt in Linux bash

Git submodule

  • Home dir add code as seperate submodule git
    1. on server # sudo -u git git init --bare NewRepo

    2. on pc code$ git submodule add git@git.server:NewRepo

Cleanup local branches already merged into Master

  1. Check what has not been merged with  git branch --no-merged 

  2. Delete branch  git branch -d  xxx 

  3. . All in one  git branch --merged master | grep -v "\* master" | xargs -n 1 git branch -d 

Manage homedir on new server from existing git repo

  • Setup repo, with no-checkou
    •  git clone --depth 2 --no-checkout repo-to-clone . 

  • Create a branch to keep current files local
    • git branch original_201802
      git checkout original_201802
      git add .
      git commit 
  • switch back to main branch
    •  git checkout dev 

  • Merge original file back into dev if required.
    •  git merge original-201802 

...


CategoryLinux

GitHowTo (last edited 2022-02-14 03:19:33 by PieterSmit)