cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar








Etc


Reference














.

middleware:version-control:git:dotfiles.html



Git - How to use Git.

How to manage dotfiles with GitHub

Create dotfiles

$ mkdir dotfiles
$ cd dotfiles
$ vi .vimrc
$ vi .bashrc
$ vi dotfilelink.sh
#!/bin/sh
 
 
FILE=".vimrc .bashrc"
cd ~/
for i in $FILE
do
    test -f ~/${i} && cp ~/${i}  ~/${i}.`date -d '1day ago' +%Y%m%d`
    ln -s ~/dotfiles/${i} ~/${i}
done


Git User Configuration

$ git config --global user.name XXXXX
$ git config --global user.email xxxx@xxxx.xxx

$ git config --global --list    <- check user configuration


push GitHub

$ cd ~/dotfiles
$ git init
$ git add .
$ git commit -m 'first commit'
$ git remote add origin git://github.com/your_name/dotfiles.git
$ git push origin master 


clone with Other Server

$ cd ~/
$ git clone https://github.com/your_name/dotfiles
$ ls
dotfiles
$ sh dotfiles/dotfileslink.sh


Update

$ git add .
$ git status
$ git commit -m "anything"
$ git push origin master


Sync with GitHub




middleware/version-control/git/dotfiles.html.txt ยท Last modified: 2018/04/22 by admin

Page Tools