GithubHelp home page GithubHelp logo

xunop / dotfile Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 102.47 MB

This Git repository stores the configuration files for my personal computer

License: GNU General Public License v3.0

Shell 86.92% CSS 6.00% Python 7.08%

dotfile's Introduction

dotfile

This Git repository stores the configuration files for my personal computer.

Referenced from this article: How to Store Dotfiles - A Bare Git Repository | Atlassian Git Tutorial

Usage

Install dotfile from repo

  1. Create an alias for the Git repository using the config command:
alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
  1. Add .cfg folder to .gitignore
echo ".cfg" >> .gitignore
  1. Clone repo:
git clone --bare <git-repo-url> $HOME/.cfg
  1. Checkout the actual content from the bare repository to your $HOME:
config checkout

if you fail with a message like:

error: The following untracked working tree files would be overwritten by checkout:
    .bashrc
    .gitignore
Please move or remove them before you can switch branches.
Aborting

This is because your $HOME folder might already have some stock configuration files which would be overwritten by Git. I alaways delete those files.

According to that article you can save these file like this:

mkdir -p .config-backup && \
config checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | \
xargs -I{} mv {} .config-backup/{}

rerun config chekout

Don't forget to enter the following command, this command tells Git not to display status informantions for untracked files (i.e., files that are not under version control). the --local parameter indicates that this configuration is only valid for the current repository.

config config --local status.showUntrackedFiles no

Tracking your configurations in a Git repository

  1. Initialize the Git repository:
git init --bare $HOME/.cfg
  1. Create an alias for the Git repository using the config command:
alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'

You can use this command to add an alias to the user's .bashrc/.zshrc file so that it can be used every time you start the terminal:

echo "alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'" >> $HOME/.zshrc
  1. Configure Git to ignore untracked files:
config config --local status.showUntrackedFiles no
  1. Add your configuration files to the Git repository:
config add <file>
config commit -m "<commit message>"
  1. Push your changes to a remote repository:
config push <remote> <branch>

dotfile's People

Contributors

xunop avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.