Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How not to forget to add files

Tags:

git

repository

I situation that often occurs for me is :

  • I create a new file
  • I modify an existing file

Everything compiles, I'm proud of myself.

  • I commit
  • I push it to the server

My teammates pull : They can't compile because a file is missing. They all want to kill me.

The question is, how to make sure I've added all needed files?

like image 752
Epitouille Avatar asked May 20 '15 10:05

Epitouille


1 Answers

I always do git status before pushing, to make sure I did not miss anything in the "to add" file list.

The output is quite explanatory:

$ git status
On branch XXX
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   YYY

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    ZZZ1
    ZZZ2

Then, it is also good to have some kind of staging environment that is shared with everyone. This way, when you push you also make sure the staging environment is also stable, so others will have a working example of your recent changes:

$ git checkout staging
$ git pull --rebase
$ git merge <your_branch>
$ git push
like image 57
fedorqui 'SO stop harming' Avatar answered Sep 30 '22 19:09

fedorqui 'SO stop harming'