1.2.9 • Published 8 years ago

gitswap v1.2.9

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

gitswap

Build Status npm version GitHub version

This project has come out of my annoying habit of committing to my personal repos with my work account and more embarrassingly committing to my work repos with my personal account.

Idea came from https://github.com/joealba/gitswitch, a ruby git profile switcher.

How gitswap works depends on the directory where you run it. If within a git repository directory invoking gitswap with a profile will append/change this in the .git/config file. If not in a git repository directory then the global ~/.gitconfig file is updated.

Install

npm install -g gitswap

Usage

To initialize, run:

gitswap

Gitswap will read your .gitconfig file and check for a .gitswap file in your home directory, if one is not present, it will ask you to create one.

It takes the current username and email in your .gitconfig file and places these under the tag of orig.

Use the flag --add to add further profiles to your .gitswap file. Once you've filled your .gitswap file with all the profiles you need simply run the following to swap to that profile:

gitswap [tag]

If this is run within a git repository it will update the local config for that repo with the correct user details. You can override this by passing the --global flag (see below).

Optional flags

There are a number of flags you can pass to gitswap:

Add new

gitswap --add [-a]

Prompts for a new profile to be added to your cache.

Current profile

gitswap --current [-c]

Lists the current profile in use, if within a git repo, will report local profile else will return the global profile.

List all

gitswap --list [-l]

Lists all profiles saved in your .gitswap file

Global flag

gitswap [tag] --global [-g]

Updates the global .gitconfig file to the supplied tag. The --global/-g are optional. If you are in a git repository directory you may wish to use this to skip updating the repo config and jump straight to update the global, if you are not in a repo directory gitswap will update the global config as a default.

Version

gitswap --version [-v]

Displays the current npm version package you have installed

Updating

You most likely installed through npm, simply run the following to update:

npm update gitswap -g
1.2.9

8 years ago

1.2.8

8 years ago

1.2.7

8 years ago

1.2.6

8 years ago

1.2.5

8 years ago

1.2.4

8 years ago

1.2.3

8 years ago

1.2.2

8 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.0.13

8 years ago

1.0.12

8 years ago

1.0.11

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago