Herramientas de usuario

Herramientas del sitio


wiki2:gitlist

Git tools

Gitlist

Gitea

Supervisor config file for the process:

[program:gitea]
user = root
directory=/srv/gitea/
command=/srv/gitea/gitea web
autostart=true
autorestart=false
environment = HOME="/home/root", USER="root"

Git Extras

git info

$ git info

## Remote URLs:

origin      git@github.com:sampleAuthor/git-extras.git (fetch)
origin      git@github.com:sampleAuthor/git-extras.git (push)

## Remote Branches:

origin/HEAD -> origin/master
origin/myBranch

## Local Branches:

myBranch
* master

## Most Recent Commit:

commit e3952df2c172c6f3eb533d8d0b1a6c77250769a7
Author: Sample Author <sampleAuthor@gmail.com>

Added git-info command.

Type ´git log´ for more commits, or ´git show <commit id>´ for full commit details.

## Configuration (.git/config):

color.diff=auto
color.status=auto
color.branch=auto
user.name=Sample Author
user.email=sampleAuthor@gmail.com
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=git@github.com:mub/git-extras.git
branch.master.remote=origin
branch.master.merge=refs/heads/master

pull requests & merge requests

  • git-mr checks out a merge request from GitLab
  • git-pr checks out a pull request on GitHub
$ git mr 51
From gitlab.com:owner/repository
 * [new ref]         refs/merge-requests/51/head -> mr/51
Switched to branch 'mr/51'

git-release

By combining commit, tag, and push into a single command, git-release saves a lot of keystrokes for executing three commands that often run in sequence.

To commit with a specific <tagname> and a custom message:

$ git release 0.1.0 -m <+ powerful feature added>

Patches

Create a file with changes:

  • Create a git patch for each changed file: git format-patch <target-branch>
  • Create only one git patch file with all changes: git format-patch <target-branch> –stdout patch_name.patch
  • Create a path from a commit: git format-patch -1 <commit-hash>
  • Show the path changes: git apply –stat <patch_file_path>
  • Apply the path: git apply <patch_file_path>
  • Apply the path and create a commit: git am <patch_file_path>

pre-commit

Install:

sudo pip3 install pre-commit

To use it with black, add this to .pre-commit-config.yaml:

repos:
  - repo: https://github.com/psf/black
    rev: stable
    hooks:
      - id: black
        language_version: python3.8

Then to set up the git hook scripts

run pre-commit install 

Now pre-commit will run automatically on git commit!

pre-commit run --all-files

Git Hooks

wiki2/gitlist.txt · Última modificación: 2020/08/25 17:39 (editor externo)