{"id":23915763,"url":"https://github.com/imgios/git-profile","last_synced_at":"2025-02-23T19:26:18.350Z","repository":{"id":41815919,"uuid":"476301744","full_name":"imgios/git-profile","owner":"imgios","description":"Switch between various git profiles easily. ✨","archived":false,"fork":false,"pushed_at":"2024-05-23T08:03:32.000Z","size":94,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-05-23T09:33:04.314Z","etag":null,"topics":["bash-script","git-config","git-profiles"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imgios.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-31T12:45:10.000Z","updated_at":"2024-05-27T15:42:22.843Z","dependencies_parsed_at":"2024-05-27T15:42:20.671Z","dependency_job_id":null,"html_url":"https://github.com/imgios/git-profile","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imgios%2Fgit-profile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imgios%2Fgit-profile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imgios%2Fgit-profile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imgios%2Fgit-profile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imgios","download_url":"https://codeload.github.com/imgios/git-profile/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240366918,"owners_count":19790167,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash-script","git-config","git-profiles"],"created_at":"2025-01-05T11:47:08.458Z","updated_at":"2025-02-23T19:26:18.303Z","avatar_url":"https://github.com/imgios.png","language":"Shell","readme":"# 🔀 Git Profile\n\nBash script in order to switch between various Git profiles, where each profile is represented as `.gitconfig` file.\n\n\u003e A scenario could be:\n\u003e - A Git profile with the working email (e.g. imgios@github.com) and ssh-key defined to access a repository hosted on the intranet;\n\u003e - A different Git profile with the personal email (e.g. imgios@giosuesulipano.it) to access a repository hosted on GitHub (or any other hosting)\n\n## Getting Started\n\nThese instructions will get you a copy of the project up and running on your local machine for usage, development and testing purposes.\n\n### Prerequisites\n\n- Git\n- Shell/Bash 🤷🏻‍♂️\n\n### Installing\n\n1. Download the [latest release](https://github.com/imgios/git-profile/releases) or clone the repository:\n```shell\n$ git clone https://github.com/imgios/git-profile.git\n```\n2. Make the script executable:\n```shell\n$ chmod +x git-profile\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003cb\u003e(Optional) Global installation and Bash completion ➡\u003c/b\u003e\u003c/summary\u003e\n  \n  - Install the script:\n  \n  ```shell\n  $ sudo install -o root -g root -m 0755 git-profile /usr/local/bin/git-profile\n  ```\n\n  - Source the bash completion:\n  \n  ```shell\n  $ echo \"source \u003c(git-profile completion)\" \u003e\u003e .bashrc\n  ```\n\n\u003c/details\u003e\n\n3. Create the `~/.gitprofile` dir and save your actual `.gitconfig` in the profiles path:\n```shell\n# Manual\n$ mkdir ~/.gitprofile \u0026\u0026 cp ~/.gitconfig ~/.gitprofile/default.gitconfig # You can use any name you wish to use\n# Using the script\n$ git-profile save \u003cname\u003e # If you have the alias you can use git-profile -s\n```\n4. Create a new `.gitconfig` file in the profiles path for each account you want to configure (e.g. `github.gitconfig`, `gitlab.gitconfig`, ...), and switch between them using the script:\n```shell\n$ git-profile set \u003cprofile-name\u003e\n```\n\n### Usage\n\nBefore starting make sure you have saved (see [Installing - Point 3](#installing)) your currently used `.gitconfig`, otherwise you will risk to lose it. Then navigate in the `~/.gitprofile` path and create a new `.gitconfig` for each profile you want to setup.\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003cb\u003eGitConfig example ➡\u003c/b\u003e\u003c/summary\u003e\n  \n  ```GitConfig\n  # Example .gitconfig used as Git profile\n  [user]\n    name = Your Name\n    email = your-email@example.com\n  \n  [color]\n    ui = auto\n  \n  [alias]\n    co = checkout\n    ci = commit\n    st = status\n    br = branch -av\n    brdel = branch -D\n  \n    # Show all configured aliases\n    aliases = !git config --list | grep 'alias\\\\.' | sed 's/alias\\\\.\\\\([^=]*\\\\)=\\\\(.*\\\\)/\\\\1\\\\ \\t =\u003e \\\\2/' | sort\n  \n    # Log format view\n    lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)\u003c%an\u003e%Creset' --abbrev-commit --date=relative\n    hist = log --pretty=format:\\\"%h %ad | %s%d [%an]\\\" --graph --date=short\n  ```\n\n\u003c/details\u003e\n\nWhen you're done populating the profiles path, you can start using the script:\n\n```shell\n$ git-profile help\nUSAGE: git-profile \u003ccommand\u003e [profile] [options]\n \n  where: \u003cprofile-name\u003e is a \u003cprofile-name\u003e.gitconfig files in /home/imgios/.gitprofile\n \n  commands:\n    set           Set the profile specified as third argument.\n    save          Save the profile in-use as default.gitconfig in /home/imgios/.gitprofile.\n                  An argument can be passed to customize the profile name.\n    list          List all the available profiles present in /home/imgios/.gitprofile\n    help          Show this help test.\n    version       Show git-profile version.\n \n  flags:\n    -d,--dir      Specify the Git Profiles directory that will be used to retrieve/store all profiles.\n    -v,--verbose  Increase the log level to DEBUG.\n \n  examples:\n    git-profile set github\n    git-profile save work -d /etc/.gitprofile\n    git-profile list\n \n  Feedbacks and issues can be reported at https://github.com/imgios/git-profile\n```\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](CONTRIBUTING.md) for details on the code of conduct, and the process for submitting pull requests.\n\nSee also the list of [contributors](https://github.com/imgios/git-profile/contributors) who participated in this project.\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/imgios/git-profile/tags).\n\nThe current version in development can always be found in the [`dev`](https://github.com/imgios/git-profile/tree/dev) branch.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimgios%2Fgit-profile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimgios%2Fgit-profile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimgios%2Fgit-profile/lists"}