I started using git when I was studying for small projects and then the workflow was git add file
when having made a new file and then git commit -m ...
for subsequent changes.
Now I’m in a new professional larger project where we use git flow
. we didn’t have any actual problems with git but I wonder why I must make git add
now every time I make changes. Is it because I always make a new branch for just myself when we use git flow
and therefore I must add the files to an initially empty branch?
Can you please let me know how I can get more skilled at using git flow
?
2
Often you have files which appear in your project directory which you don’t want to have in your git repository. For example files the software reads and writes in its own directory as part of its operation. That’s why git doesn’t blindly index everything in the project directory but instead asks you to add files manually. Also, any binary files should usually not be added to git because it can not handle them well.
Also, sometimes you make multiple changes which are actually separate issues. In that case you often want to break it down into two separate commits by first adding the changes to one file, committing it, and then adding the others.
When this problem does not apply to you in your case, you can use git add --all
to add all files in the directory. You can even use git commit --all
to add and commit all files in your working tree with a single command.
2