• 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 alias tab completion for functions

Last updated on February 6, 2022 by Sal Ferrarello

When creating a Git alias that points to a function, sometimes Git provides the wrong tab completion by default (e.g. filename completion instead of branch name completion). This is how we can tell Git, which type of completion to use.

Filed Under: Dev Tips, Programming, Solution Tagged With: Git, git alias

git reset vs revert

Last updated on November 15, 2021 by Sal Ferrarello

Conceptually, “git reset” is erasing your last change while “git revert” is adding a new change that undoes your previous change.

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

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

Remove newline at end of text file

Last updated on February 10, 2022 by Sal Ferrarello

Sometimes when I’m working with files in Git, I find myself with a change in a file that says “No newline at end of file”. This occurs when my editor adds the missing newline at the end of the file. While you should have a newline at the end of the file, you may have a reason for not wanting to add this change. In that case, you can remove the newline from the end of the file.

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

Filed Under: Computing, Dev Tips, Draft, Solution Tagged With: command line, Git

Git alias 'git open-pr-github' and the webpage it opens to.

Git Alias Open Pull Request on GitHub

Last updated on December 1, 2022 by Sal Ferrarello

I want to be able to type “git open-github-pr” and have my browser open to the GitHub URL to create a Pull Request (PR) for my current branch on the current project I’m working on. Here is how I built this.

Filed Under: Dev Tips, Solution Tagged With: Git, git alias, GitHub

Your edited hunk does not apply

Last updated on March 24, 2021 by Sal Ferrarello

When using git add -p and faced with a hunk that can not be split sufficiently for your purposes, you can use the e option (manually edit the current hunk). Unfortunately, after manually editing the current hunk it is common to get the message “Your edited hunk does not apply.” I’ve found there are some things I can do to avoid this failure.

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

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

Building blocks representing two Git branches, one with a merge commit where the top commit has two parents.

Git Merge Commit with Blocks

Last updated on May 9, 2022 by Sal Ferrarello

We can’t do a fast-forward merge when the most recent commit on the receiving branch does not appear in the branch we are merging in. One of our options in this situation is to create a merge commit when we merge in our branch.

Filed Under: Dev Tips, Programming Tagged With: Git

Should I add .env to .gitignore?

Last updated on February 11, 2021 by Sal Ferrarello

The short answer is, “yes”. You should use your .gitignore file to ignore the .env file.

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

Filed Under: Dev Tips, Draft, Recommendations Tagged With: Git, gitignore

.gitignore Hidden Files with Exceptions

Last updated on February 13, 2021 by Sal Ferrarello

In most operating systems by default, files that start with a period (.) are hidden. When setting up my .gitignore file, I like to ignore all these hidden files (with a few exceptions).

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

Filed Under: Dev Tips, Draft, Recommendations Tagged With: Git, gitignore

Starter .gitignore file

Last updated on January 28, 2022 by Sal Ferrarello

This is my general starter .gitignore file for projects. I have a separate .gitignore for WordPress websites.

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

Filed Under: Dev Tips, Draft, Recommendations Tagged With: Git, gitignore

git add -p

Last updated on February 13, 2021 by Sal Ferrarello

By using “git add -p”, I can include some of my current changes in my commit (without including all of my changes).

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

Filed Under: Dev Tips, Draft Tagged With: Git

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

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