User Tools

Site Tools



Git Tips

GitHub's introduction to Git is a good tutorial for starters. Git Immersion is another good git tutorial. Read them to get a grasp of the paradigms behind Git.

Read this article for a basic set of Git best practices.

Make small commits; make descriptive commit messages. Read more here.

Do not commit files that may be obtained from files already in the repository. Do not commit object files or executable files that are compiled out from source code files. You may commit images files or other binary files that can't be obtained from source code files inside the repository.

Merge and rebase are two sometimes misunderstood methods of adding commits using git. This blog post offers some insight into the matter. If you have commits that you haven't pushed yet and want to bring yourself up to date, always use git pull --rebase to pull new commits. Not doing so will keep the old head as a parent commit for your (yet un-pushed) commits. Pushing that into the main repository will have the nasty side effect of turning it into a branch/merge Christmas tree, which is something we want to avoid at all costs.

Make sure there aren't any trailing whitespaces in your file. The waste space; Git usually complains about this when you create a commit.

The Windows OS has the habbit of using executable permissions for files such as source code or text files. These don't required executable permissions and you should make sure they don't use them.

For more in depth tips, read the “Git is the Answer” series:

tutorials/git-tips.txt · Last modified: 2020/07/20 09:16 (external edit)