0

My teammates and I were getting tired of running these same 3 commands every time we checked out a new branch and now I am wanting to push the changes I've made to the Git repo so they can start using it. The file I modified does not pop up in git status when I changed it. How can I push it to the git repo? Here's the file I added to /.git/hooks/post-checkout

#! /bin/sh

# Start from the repository root.
cd ./$(git rev-parse --show-cdup)

# drop migrate and set up.
rake db:drop
rake db:migrate
rake db:setup
lakeIn231
  • 1,177
  • 3
  • 14
  • 34

2 Answers2

0

The .git folder is in not tracked actually. To reuse these commands, you should put them.

You need to create a global hook:

https://coderwall.com/p/jp7d5q/create-a-global-git-commit-hook

Yury Lebedev
  • 3,985
  • 19
  • 26
0

Git hooks are not kept track of by your git repository. See this answer.

To the linked answer I'd add that you could keep your hooks in a separate repository and include it in your current repository as a submodule. Then, as stated in the response above, have everyone symlink the .git/hooks repo to your submodule.

Community
  • 1
  • 1
houtanb
  • 3,852
  • 20
  • 21