Utility that helps you switch git configurations with ease.

Overview

git-profile

Utility that helps you switch git configurations with ease

Build Status Latest Version Software License

Preface

It is possible that you have multiple git configurations. For example:

; Office Profile
Name: John Doe
Email: [email protected]

; Personal Profile
Name: John Doe
Email: [email protected]

It could be a hassle to remember and switch between the profiles while working on different projects.

This utility aims to make this hassle free.

Features

  • Create and manage profiles globally; create once, use anywhere
  • Set profile for a specific project
  • Set global profile with a single command

This utility helps you save profiles and then you can switch between them using a single command.

Install

$ composer global require zeeshan/git-profile

Then check your $PATH variable. It must contain ~/.composer/vendor/bin dir.

$ echo $PATH

/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/home/username/.composer/vendor/bin

Modify your .zshrc or .bashrc files if your $PATH variable not contain composer/bin dir.

export PATH=~/.composer/vendor/bin:$PATH

Also you can use .phar file

  • Download the file from here
  • sudo chmod -R 755 git-profile
  • sudo mv git-profile /usr/local/bin/git-profile

Usage

$ git-profile [options] <command>

Options

-h, --help              Display this help message
-V, --version           Display this application version
--ansi                  Force ANSI output
--no-ansi               Disable ANSI output

Commands

rm                      Remove git profile
use                     Change git profile locally or globally
add                     Create a new git profile
show                    Show details for an existing profile
update                  Update details for an existing profile
current                 Gets the currently set profile
list                    List of profiles

Examples

Find some of the sample usages below

Adding Profiles

$ git-profile add

[+] Enter profile title: Office

[+] Enter Name: John Doe
[+] Enter Email: [email protected]
[+] Enter Signingkey: B7156A83

[OK] Profile "Office" saved successfully

Remove Git Profile

$ git-profile rm "Office"

[OK] Profile "Office" successfully removed

Show Details for a profile

$ git-profile show "Office"

[+] Name:  John Doe
[+] Email: [email protected]
[+] Signingkey: B7156A83

Updating Profile

$ git-profile update "Office"

[+] Enter Name: Jane Doe
[+] Enter Email: [email protected]
[+] Enter Signingkey: 547ABB1C

[OK] Profile "Office" updated successfully

Switching Profile

Setting details locally i.e. set profile for the current project

$ git-profile use "Office"

[OK] Switched to "Office"

Setting details globally i.e. set global configuration

$ git-profile use "Office" --global

[OK] Switched to "Office"

Get Current Profile

$ git-profile current

[+] Current Profile "Office"
[+] Name: John Doe
[+] Email: [email protected]
[+] Signingkey: 547ABB1C

Side note It should be noted that profiles are maintained globally. When you use some profile locally, what it does is get the configuration for that profile and sets it for the current project. i.e. when use is run locally it is equivalent to

$ git config user.name "Name for specified profile"
$ git config user.email "[email protected]"
$ git config user.signingkey "SIGNINGKEY"

Profiles List

$ git-profile list

Available profiles:
    Github
    Home
    Office

License

MIT © Zeeshan Ahmad

Comments
  • More tests

    More tests

    ~~:warning: https://github.com/zeeshanu/git-profile/pull/11 needs to be merged first then I'll rebase this PR to remove extra commits from the previous PR~~

    This PR adds more tests.

    I converted exit() code to Exception to be able to test commands. Results are the same.

    Coverage is far better :green_heart:

    image

    opened by j0k3r 4
  • Only has three commands ?

    Only has three commands ?

    when execute git profile, here's what i got in terminal.

    Git Profile version 1.0
    
    usage:
      git profile [options] <command>
    
    Commands:
      rm               Remove git profile
      add              Create a new git profile
      use              Change git profile locally or globally
    
    Options:
      -h, --help       Display this help message
      -V, --version    Display this application version
    

    didn't see the current or show method.

    opened by lifesign 3
  • Add signingkey support

    Add signingkey support

    See https://git-scm.com/book/tr/v2/Git-Tools-Signing-Your-Work

    Also:

    • Move askQuestion & saveProfile to BaseCommand to avoid duplication
    • Use simple-phpunit instead of phpunit (see http://symfony.com/doc/current/components/phpunit_bridge.html). Basically it display deprecated message from Symfony but also provide PHPUnit support for all version using the lowest available

    Also I think phpcs is bit outdated and it should be better to use php-cs-fixer instead. I might be able to push an other PR with that change after that one got merged if you want.

    opened by j0k3r 2
  • Configure Renovate

    Configure Renovate

    Welcome to Renovate! This is an onboarding PR to help you understand and configure settings before regular Pull Requests begin.

    :vertical_traffic_light: To activate Renovate, merge this Pull Request. To disable Renovate, simply close this Pull Request unmerged.


    Detected Package Files

    • composer.json (composer)

    Configuration Summary

    Based on the default config's presets, Renovate will:

    • Start dependency updates only once this Configure Renovate PR is merged
    • Separate major versions of dependencies into individual branches/PRs
    • Do not separate patch and minor upgrades into separate PRs for the same dependency
    • Upgrade to unstable versions only if the existing version is unstable
    • Raise PRs immediately (after branch is created)
    • Use renovate/ as prefix for all branch names
    • If semantic commits detected, use semantic commit type fix for dependencies and chore for all others
    • Keep existing branches updated even when not scheduled
    • Disable automerging feature - wait for humans to merge all PRs
    • Ignore node_modules, bower_components, vendor and various test/tests directories
    • Update existing lock files only when package.json is modified
    • Autodetect whether to pin dependencies or maintain ranges
    • Rate limit PR creation to a maximum of two per hour
    • Limit to maximum 20 open PRs at any time
    • Group known monorepo packages together
    • Use curated list of recommended non-monorepo package groupings

    :abcd: Would you like to change the way Renovate is upgrading your dependencies? Simply edit the renovate.json in this branch with your custom config and the list of Pull Requests in the "What to Expect" section below will be updated the next time Renovate runs.


    What to Expect

    With your current configuration, Renovate will create 3 Pull Requests:

    Pin dependencies
    Pin dependency symfony/phpunit-bridge to 3.4.22
    Update symfony packages to v4 (major)

    :children_crossing: Branch creation will be limited to maximum 2 per hour, so it doesn't swamp any CI resources or spam the project. See docs for prhourlylimit for details.


    :question: Got questions? Check out Renovate's Docs, particularly the Getting Started section. If you need any further assistance then you can also request help here.


    This PR has been generated by Renovate Bot. View repository job log here.

    opened by renovate[bot] 1
  • Update package on packagist

    Update package on packagist

    Looks like the fresh new 2.0 version wasn't update on packagist: https://packagist.org/packages/zeeshan/git-profile

    Did you define the webhook on Github for auto update? Otherwise, could you update it on packagist?

    Thanks!

    opened by j0k3r 1
  • Regenerate git-profile.phar and update release

    Regenerate git-profile.phar and update release

    Can you regenerate git-profile phar file and add new tag for new release?

    Can you register your package on https://packagist.org for simple install via composer?

    opened by Rpsl 1
  • Homebrew Cask

    Homebrew Cask

    It would be really neato if you submitted this to Homebrew Cask Here's their guide on what to do https://github.com/caskroom/homebrew-cask/blob/master/doc/development/adding_a_cask.md

    I would've suggested Homebrew Core but they don't like binaries in the core.

    enhancement 
    opened by jwmann 1
  • php-cs-fixer'd

    php-cs-fixer'd

    • Use php-cs-fixer to ensure coding standards
    • Commit composer.lock to speed installation
    • Fix command in README
    • Update APPLICATION_VERSION to 2.0
    • Use branch-alias to allow dev installation
    opened by j0k3r 0
  • Meta updates

    Meta updates

    This adds license information and keywords which Packagist will use in their search results. It also adds a latest release badge, a prettier build status and a license badge.

    opened by adam-paterson 0
  • Add Travis CI

    Add Travis CI

    For open source projects we can use Travis CI to show the build status of a library. You will however need to configure the integration with this repository and create a Travis account.

    https://travis-ci.org/getting_started

    opened by adam-paterson 0
Releases(v2.1.1)
Owner
Zeeshan Ahmad
Engineering at Smart Dubai. Full Stack Developer. Tech guy with an entrepreneurial spirit and knack for getting things done.
Zeeshan Ahmad
A utility package that helps inspect functions in PHP.

A utility package that helps inspect functions in PHP. This package provides some utilities for inspecting functions (callables) in PHP. You can use i

Ryan Chandler 14 May 24, 2022
Version is a library that helps with managing the version number of Git-hosted PHP projects

Version Version is a library that helps with managing the version number of Git-hosted PHP projects. Installation You can add this library as a local,

Sebastian Bergmann 6.3k Dec 26, 2022
PHP Indexer for Switch NSP

NSP Indexer PHP Indexer for Switch NSP (XCI NSZ XCZ) by proconsule and jangrewe How To Place all files into a directory on your webserver, then copy c

null 28 Dec 15, 2022
Easy Coding Standard configurations for Craft CMS projects.

Easy Coding Standard config for Craft CMs This package provides Easy Coding Standard configurations for Craft CMS plugins and projects. In general, we

Craft CMS 10 Dec 18, 2022
A complete solution for group projects in organizations that lets you track your work in any scenario. Working in a team is a cumbersome task, ease it using our project management system.

SE-Project-Group24 What is Evolo? Evolo is Dashboard based Project Management System. A complete solution for group projects in organizations that let

Devanshi Savla 2 Oct 7, 2022
Michael Pratt 307 Dec 23, 2022
Debug - The Debug component provides tools to ease debugging PHP code.

Debug Component CAUTION: this component is deprecated since Symfony 4.4. Instead, use the ErrorHandler component. The Debug component provides tools t

Symfony 7.3k Jan 8, 2023
A simple PHP package for sending messages to Slack, with a focus on ease of use and elegant syntax.

Slack for PHP A simple PHP package for sending messages to Slack with incoming webhooks, focussed on ease-of-use and elegant syntax. Note: this packag

Regan McEntyre 1.2k Oct 29, 2022
The ErrorHandler component provides tools to manage errors and ease debugging PHP code

ErrorHandler Component The ErrorHandler component provides tools to manage errors and ease debugging PHP code. Getting Started $ composer require symf

Symfony 2.2k Jan 3, 2023
UMySQL is an extremely simple PHP library for communicating with MySQL databases with ease while keeping overhead to a bare minimum.

Uncomplicated MySQL UMySQL is an extremely simple PHP library for communicating with MySQL databases with ease while keeping overhead to a bare minimu

José Miguel Moreno 4 Oct 24, 2022
Easy to use utility functions for everyday PHP projects. This is a port of the Lodash JS library to PHP

Lodash-PHP Lodash-PHP is a port of the Lodash JS library to PHP. It is a set of easy to use utility functions for everyday PHP projects. Lodash-PHP tr

Lodash PHP 474 Dec 31, 2022
[READ-ONLY] CakePHP Utility classes such as Inflector, Text, Hash, Security and Xml. This repo is a split of the main code that can be found in https://github.com/cakephp/cakephp

CakePHP Utility Classes This library provides a range of utility classes that are used throughout the CakePHP framework What's in the toolbox? Hash A

CakePHP 112 Feb 15, 2022
Small utility library that handles metadata minification and expansion.

composer/metadata-minifier Small utility library that handles metadata minification and expansion.

Composer 134 Dec 26, 2022
m4b-tool is a command line utility to merge, split and chapterize audiobook files such as mp3, ogg, flac, m4a or m4b

m4b-tool m4b-tool is a is a wrapper for ffmpeg and mp4v2 to merge, split or and manipulate audiobook files with chapters. Although m4b-tool is designe

Andreas 798 Jan 8, 2023
Php-timer - Utility class for timing

phpunit/php-timer Utility class for timing things, factored out of PHPUnit into a stand-alone component. Installation You can add this library as a lo

Sebastian Bergmann 7.4k Jan 5, 2023
Xr - Lightweight debug server utility built on ReactPHP.

XR ?? Subscribe to the newsletter to don't miss any update regarding Chevere. XR is a dump server utility built on top of ReactPHP. Features ✨ Dump si

Chevere 195 Dec 17, 2022
Warden is a CLI utility for orchestrating Docker based developer environments

Warden Warden is a CLI utility for orchestrating Docker based developer environments, and enables multiple local environments to run simultaneously wi

David Alger 314 Dec 2, 2022
An utility component for XML usage and best practices in PHP

An utility component for XML usage and best practices in PHP

Laminas Project 13 Nov 26, 2022