• Skip to primary navigation
  • Skip to main content
Sal Ferrarello
  • About Sal Ferrarello
  • Speaking
  • Connect
    Mastodon GitHub Twitter (inactive)
You are here: Home / Archives for Git

Git

Git Get Current Branch Name

Last updated on March 18, 2023 by Sal Ferrarello

I find there are two different times I want to get the current branch name: 1. When I’m at the command line, 2. Inside a Git alias function I’m writing. Interestingly, I find that my approach in these two situations are different.

Filed Under: Computing, Dev Tips, Solution Tagged With: Git

Git Branch Naming

Last updated on February 26, 2023 by Sal Ferrarello

There are lots of ways to name Git branches. These are my personal rules I’ve developed for naming Git branches.

Filed Under: Computing, Dev Tips, Recommendations Tagged With: Git

Replace Local Git Branch with Remote Version

Last updated on February 20, 2023 by Sal Ferrarello

This situation often arises for me when I’m reviewing a teammate’s Pull Request and they make changes by rewriting history. In this situation, I want to discard my local copy of the Pull Request branch and replace it with the version on GitHub (or wherever the remote branch is being stored).

Filed Under: Computing, Dev Tips, Solution Tagged With: Git

Git autoSetupRemote Prevents “no tracking information” Error

Last updated on November 14, 2022 by Sal Ferrarello

After creating a pushing a new branch to GitHub (or any remote), when I do “git pull” I often get an error that says “There is no tracking information for the current branch”. The Git config value “autoSetupRemote”, introduced in Git version 2.38, lets us avoid this entirely error.

Filed Under: Computing, Dev Tips, Recommendations Tagged With: Git, gitconfig

Compare composer.json on Two Different Git Branches

Last updated on October 25, 2022 by Sal Ferrarello

I have composer.json files on two different branches and I want to compare their (non-dev) dependencies. This is the command I run to compare the “require” section of composer.json on my current branch to the “require” section of composer.json on another branch.

Filed Under: Dev Tips, Solution Tagged With: composer, Git, jq

Check If We Can Do a Git Fast-Forward Merge

Last updated on August 31, 2022 by Sal Ferrarello

When I’m working with Git, there are times I want to check if I can do a fast-forward merge but I do NOT want to actually perform the merge.

Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Dev Tips, Draft, Solution Tagged With: fast-forward, Git

Revert Merge Commit

Last updated on May 9, 2022 by Sal Ferrarello

Typically a Git commit has exactly one parent, however a Git merge commit has two parents. The problem this creates with Git revert, is it is unclear which commit we want to revert to.

Filed Under: Computing, Dev Tips, Solution Tagged With: Git, revert

Always Bring Your Pull Requests Up to Date

Last updated on April 26, 2022 by Sal Ferrarello

A Pull Request (PR) should always be up to date with the branch into which it is being merged. Another way of saying this is you should be able to merge your PR as a fast-forward merge (even if you decide not to do a fast-forward merge). In this post we’ll look at how a safe looking PR that is out of date can be catastrophic to merge.

Filed Under: Computing, Dev Tips, Programming, Recommendations Tagged With: Git

Intermediate Git

Last updated on March 3, 2023 by Sal Ferrarello

I’ve been using Git for a number of years. When I was a Git beginner, I followed some prescribed steps and things worked – most of the time. This seems to be a pretty common experience for people starting out with Git. The magical part is when I started to understand Git, when I went from beginner to intermediate. These are some blog posts and videos that would have helped me with that transition.

Filed Under: Dev Tips, Recommendations Tagged With: Git

git reset –hard vs git checkout -f

Last updated on February 8, 2022 by Sal Ferrarello

I recently had a conversation about “git reset –hard” vs “git checkout -f”, and it turns out they do the same thing. This is one of the tricky things about Git, there are often multiple ways to do the same thing.

Filed Under: Computing, Dev Tips Tagged With: Git

  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Interim pages omitted …
  • Go to page 7
  • Next Page»

Copyright © 2023 · Bootstrap4 Genesis on Genesis Framework · WordPress · Log in