All Projects → adamdehaven → change-git-author

adamdehaven / change-git-author

Licence: MIT License
Update the commit history of your git repository to resolve incorrect author information.

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to change-git-author

guilyx
Dynamic Profile with github statistics, coding info (time and languages) with WakaTime and music status with the spotify API, leave a ⭐ if you like it
Stars: ✭ 175 (+201.72%)
Mutual labels:  commits
nuxt-humans-txt
🧑🏻👩🏻 "We are people, not machines" - An initiative to know the creators of a website. Contains the information about humans to the web building - A Nuxt Module to statically integrate and generate a humans.txt author file - Based on the HumansTxt Project.
Stars: ✭ 27 (-53.45%)
Mutual labels:  author
commitlog
Generate Changelogs from Commits (CLI)
Stars: ✭ 63 (+8.62%)
Mutual labels:  commits
giticket
Utility to autoadd ticket number specified in your branch name to your commits!
Stars: ✭ 51 (-12.07%)
Mutual labels:  commits
nalcos
Search Git commits in natural language
Stars: ✭ 50 (-13.79%)
Mutual labels:  commits
studio-changes
📦 Generate a changelog as part of the npm version command
Stars: ✭ 49 (-15.52%)
Mutual labels:  commits
parse-author
Parse a person, author, contributor or maintainer string into an object with name, email and url properties following NPM conventions. Useful for the `authors` property in package.json or for parsing an AUTHORS file into an array of person objects.
Stars: ✭ 23 (-60.34%)
Mutual labels:  author
gulp-reporter
Error report for: CSSLint/EditorConfig/ESLint/HTMLHint/JSCS/JSHint/PostCSS/Standard/TSLint/XO
Stars: ✭ 17 (-70.69%)
Mutual labels:  author
Gitmoji
Gitmoji is an initiative to standardize and explain the use of emojis on GitHub commit messages.
Stars: ✭ 10,953 (+18784.48%)
Mutual labels:  commits
Git Quick Stats
▁▅▆▃▅ Git quick statistics is a simple and efficient way to access various statistics in git repository.
Stars: ✭ 5,139 (+8760.34%)
Mutual labels:  commits
git-explode
Explode linear sequence of git commits into topic branches
Stars: ✭ 43 (-25.86%)
Mutual labels:  commits

Change Git Author

This action is destructive to your repository's history. If you're collaborating on a repository with others, it's considered bad practice to rewrite published history.

You should only do this in an emergency.

Running this script rewrites history for all repository collaborators. After completing these steps, any person with forks or clones must fetch the rewritten history and rebase any local changes into the rewritten history.

Usage

  1. Download the script from GitHub and save it to an easily-accessible directory on your computer.

  2. Change the permissions of the script file to allow it to execute:

    chmod +x /path/to/changeauthor.sh
  3. Navigate into the repository with the incorrect commit history

    cd path/to/repo

    Alternatively, you can run from anywhere by passing the --git-dir and --work-tree flags.

  4. Run the script (with or without flags)

    ./changeauthor.sh [OPTIONS]...

    If you did not change the permissions to allow execution, you can also call the script with either of the following:

    bash ./changeauthor.sh [OPTIONS]...
    
    sh ./changeauthor.sh [OPTIONS]...

    If you run the script with no option flags, you will be prompted for the needed values via interactive prompts. The script will then proceed to update your local repository and push the changes to the specified remote.


If you would like to suppress the git-filter-branch warning, simply add the following line the ~/.bashrc file on your computer:

export FILTER_BRANCH_SQUELCH_WARNING=1

If you prefer to set up the script as a function you can call from anywhere, add the following function to your ~/.bashrc file:

function changegitauthor() {
  # Update the path to point to the absolute path of the script on your computer
  bash /c/absolute/path/to/change-git-author/changeauthor.sh "$@"
}

Options

You may pass options (as flags) directly to the script, or pass nothing to run the script in interactive mode.

old-email

The old/incorrect email address of the author you would like to replace in the commit history.

new-email

The new/corrected email address to replace in commits matching the old-email address.

new-name

  • Usage: -n, --new-name
  • Example: Marty McFly

The new/corrected name for the new commit author info. (Be sure to enclose name in quotes)

remote

  • Usage: -r, --remote
  • Default: origin
  • Example: github

The name of the repository remote you would like to alter.

force

  • Usage: -f, --force

Allows the script to run successfully in a non-interactive shell (assuming all required flags are set), bypassing the confirmation prompt.

If you do not pass a value to the --remote flag when using --force, the default remote (origin) will be used.

WARNING

By passing the --force flag (along with all other required flags), there is no turning back. > Once you start the script, the process will start and can severely damage your repository if used incorrectly.

git-dir

  • Usage: -d, --git-dir

Set the path to the repository (".git" directory) if it differs from the current directory. It can be an absolute path or relative path to current working directory.

This option should be used in conjunction with the --work-tree flag.

work-tree

  • Usage: -w, --work-tree

Set the path to the working tree. It can be an absolute path or a path relative to the current working directory.

help

  • Usage: -h, -?, --help

Show the help content.

version

  • Usage: -v, -V, --version

Show version information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].