0% found this document useful (0 votes)
7 views1 page

Commits in Detail

Uploaded by

wevevid773
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Commits in Detail

Uploaded by

wevevid773
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Atomic Commits

When possible, a commit should encompass a single feature, change, or fix. In other words, try to
keep each commit focused on a single thing. This makes it much easier to undo or rollback changes
later on. It also makes your code or project easier to review.

Writing Good Commit Messages (Not have to


follow)

Using present tense not past tense


Describe your changes in imperative mood, e.g. “make xyzzy do frotz” instead of “[This patch]
makes xyzzy do frotz” or “I changed xyzzy to do frotz”, as if you are giving orders to the codebase to
change its behavior.

Amending Commits

Suppose you just made a commit and then realized you forgot to include a file! Or, maybe you made
a typo in the commit message that you want to correct.

Rather than making a brand new separate commit, you can “redo” the previous commit using the --
amend option (can’t do with more than 2 previous commits)

Git Ignore

We can tell Git which files and directories to ignore in a given repository, using a .gitignore file.
This is useful for files you know you NEVER want to commit, including:

Runtime Files: These are files generated during program execution, such as log files, lock
files, cache files, or temporary files. You can ignore them using patterns like:

*.log
*.lock
/cache/
/tmp/

Sensitive Information: Files containing sensitive information, such as passwords, API keys,
or configuration files, should be excluded. For example:

secret.txt
api_key.json
.env

Compiled Code: Ignore compiled code files, such as .class (Java) or .o (C/C++). For
instance:

*.class
*.o

Build Directories: Ignore build output directories, such as /public , /out , or /dist

/public/
/out/
/dist/

Dependency Directories: Exclude directories containing dependencies, like /vendor or


/node_modules

/vendor/
/node_modules/

Create a file called .gitignore in the root of a repository. Inside the file, we can write patterns to
tell Git which files & folders to ignore

You might also like