I'm using unity. when I start a new project I should do this:
- git init
- Add .gitignore
$ git flow init -d
$ git lfs install
- Add .gitAttribute
is there any way to do this automatically? like, write a shell script.
I'm using unity. when I start a new project I should do this:
$ git flow init -d
$ git lfs install
is there any way to do this automatically? like, write a shell script.
I am not sure if I understand exactly what you mean but, assuming you are asking how to execute that series of commands every time you start a new project, how about creating an alias?
You can edit your ~/.bash_aliases
or ~/.bashrc
file to have a custom command such as:
# Custom git initialization
alias custom-command='git init && touch .gitignore && \
git flow init -d && git lfs install && touch /path-to-attributes/.gitAttribute'
Now every time you run custom-command
inside the terminal, it will run all of the above automatically.
#!/usr/bin/env sh
git rev-parse --is-inside-work-tree &> /dev/null || {
git init &&
curl -L -o .gitignore https://github.com/github/gitignore/raw/master/Unity.gitignore &&
git add -A &&
git commit -m 'Add .gitignore' &&
git flow init -d &&
git lfs install &&
curl -L -o .gitattributes https://github.com/alexkaratarakis/gitattributes/raw/master/Unity.gitattributes &&
git add -A &&
git commit -m 'Add .gitattributes'
}
Save it in a file like unity-init.sh
and put it in PATH
.