Track file inside ignored directory

To add to “.gitignore exclude folder but include specific subfolder”, one good way to debug those .gitignore file is to use git check-ignore (Git 1.8.4+): git check-ignore -v my_folder/my_file.md You would see it is still ignored because of the my_folder/ rule. That is because it is not possible to re-include a file if a parent …

Read more

File not shown in git diff after a git add. How do I know it will be committed?

If you’d like to see the staged changes in a diff, you can still use git diff, you just need to pass the –staged flag: david@pav:~/dummy_repo$ echo “Hello, world” > hello.txt david@pav:~/dummy_repo$ git status # On branch master # # Initial commit # # Untracked files: # hello.txt nothing added to commit but untracked files …

Read more

git status (nothing to commit, working directory clean), however with changes commited

Your local branch doesn’t know about the remote branch. If you don’t tell git that your local branch (master) is supposed to compare itself to the remote counterpart (origin/master in this case); then git status won’t tell you the difference between your branch and the remote one. So you should use: git branch –set-upstream-to origin/master …

Read more

What flow causes Github commits that are “authored” by one user but “committed” by another?

Git distinguishes between authors and committers (see Difference between author and committer in Git?). Authors are the people who wrote a specific piece of code – committers are the people who put these changes into the git “history”. Normally both are the same (and doesn’t change on merging, cloning, pushing or pulling). Causing the two …

Read more

How can I change the default comments in the git commit message?

There is commit.template configuration variable, which according to git-config(1) manpage: Specify a file to use as the template for new commit messages. “~/” is expanded to the value of $HOME and “~user/” to the specified user’s home directory. You can put it in per-repository (.git/config), user’s (~/.gitconfig) and system (/etc/gitconfig) configuration file(s).