Git Hooks

Git hooks are scripts that run automatically every time a particular event occurs in a Git repository. They let you customize Git’s internal behavior and trigger customizable actions at key points in the development life cycle. Atlassian on Git Hooks.

Git Branch

Branch Naming Strategies

Branch names can be anything you’d like. However, your organization or project may have standards outlined for branch naming. For example, naming the branch based on the person responsible for working on the branch and a description or work item:
  • username/description
  • username/workitem
You can name a branch to indicate the branch’s function, like a feature, bug fix, or hotfix:
  • bugfix/description
  • feature/feature-name
  • hotfix/description
Another branching strategy is having branches dedicated to the different development cycles, like feature or hotfix. As work items come up, you create a branch for that item from its respective branch. Yes, you can create branches from branches! Check out Option 4 below for an example. [1]

Git Merge

1.When you switch to main, your files will temporarily show the old state, but don't worry - all your changes are safely stored in your development-temp branch. They're not lost.
The recommended process is: 1. Switch to main (yes, you'll briefly see the old code) 2. Immediately merge development-temp into main (which will bring all your new changes into main) 3. After the merge, main will have all your latest work
This is the standard and safest way to merge branches. Your development-temp branch will still exist afterward, so you can't lose anything. If something goes wrong (which is unlikely), you can always switch back to development-temp where all your work is safe.
bash
git checkout main
git diff site/src/content/tooling/Software\ Development/Databases/Postgres.md
git merge development-temp --strategy-option theirs
git add site/src/content/tooling/Software\ Development/Databases/Postgres.md
git commit -m "Merge development-temp branch, keeping development-temp version of Postgres.md"
git status
git log --oneline -n 3
git log -n 1
git merge development-temp
git diff site/src/content/tooling/Software\ Development/Databases/Postgres.md