Streamlining Your Git Commit Workflow: Commands and Handy Aliases ☕

Git workflows are essential for maintaining a clean and efficient development process. Whether you’re working solo or collaborating with a team, structuring your commits properly ensures that changes are tracked, conflicts are minimized, and dependencies stay up to date. Below, I'll break down a common Git commit workflow and explore time-saving aliases to simplify these steps. A basic Git Commit Workflow to create new code 1. If you are not on main, switch to the main Branch git checkout main # Or use the alias: gcm 2. Code ... Code ... Code ☕ 3. Stash Your Changes git stash # Alias: gs 4. Pull Latest Changes git pull # Alias: gl 5. Create and Switch to a New Branch git checkout -b # Alias: gcb 6. Git Commit git commit -m "feat(subject): descriptive message" 7. Push Branch to Remote git push -u origin HEAD && gh pr create --fill --body '' # Obs: this uses the gh cli 8. Code Review... . After merging to main. git checkout main # Or use the alias: gcm git pull # Alias: gl Git Aliases Configuration Add to .gitconfig: [alias] co = checkout s = status -sb Shell Aliases Add to your shell profile: alias gs="git stash" alias gl='git pull' alias gstp='git stash pop' alias gcb='git checkout -b' alias gcm='git checkout main' In Conclusion Always start from an updated main branch to avoid conflicts Every possible conflict will be solved locally Use dedicated branches for isolated work Keep commits small and focused with clear messages Leverage aliases to save time on repetitive commands Woovi Woovi is a Startup that enables shoppers to pay as they like. Woovi provides instant payment solutions for merchants to accept orders to make this possible. If you want to work with us, we are hiring! Photo by Deva Darshan on Unsplash

Jan 21, 2025 - 17:36
 0
Streamlining Your Git Commit Workflow: Commands and Handy Aliases ☕

Git workflows are essential for maintaining a clean and efficient development process.

Whether you’re working solo or collaborating with a team, structuring your commits properly ensures that changes are tracked, conflicts are minimized, and dependencies stay up to date.

Below, I'll break down a common Git commit workflow and explore time-saving aliases to simplify these steps.

A basic Git Commit Workflow to create new code

Workflow

1. If you are not on main, switch to the main Branch

git checkout main  # Or use the alias: gcm

2. Code ... Code ... Code ☕

3. Stash Your Changes

git stash  # Alias: gs

4. Pull Latest Changes

git pull  # Alias: gl

5. Create and Switch to a New Branch

git checkout -b   # Alias: gcb 

6. Git Commit

git commit -m "feat(subject): descriptive message"

7. Push Branch to Remote

git push -u origin HEAD && gh pr create --fill --body ''  # Obs: this uses the gh cli

8. Code Review...

. After merging to main.

git checkout main  # Or use the alias: gcm
git pull  # Alias: gl

Git Aliases Configuration

Add to .gitconfig:

[alias]
    co = checkout
    s = status -sb

Shell Aliases

Add to your shell profile:

alias gs="git stash"
alias gl='git pull'
alias gstp='git stash pop'
alias gcb='git checkout -b'
alias gcm='git checkout main'

In Conclusion

  • Always start from an updated main branch to avoid conflicts
  • Every possible conflict will be solved locally
  • Use dedicated branches for isolated work
  • Keep commits small and focused with clear messages
  • Leverage aliases to save time on repetitive commands

Woovi

Woovi is a Startup that enables shoppers to pay as they like. Woovi provides instant payment solutions for merchants to accept orders to make this possible.

If you want to work with us, we are hiring!

Photo by Deva Darshan on Unsplash

What's Your Reaction?

like

dislike

love

funny

angry

sad

wow