Git: Difference between revisions

From Fundamental Ramen
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
<source lang="bash">
<source lang="bash">
# Unstage a file
git reset --  src/sequelize-eparking/models/Fee.js
# Remove unused branches
# Remove unused branches
git branch | grep 'feature/' | cut -c3- | xargs git branch -D
git branch | grep 'feature/' | cut -c3- | xargs git branch -D

Revision as of 10:47, 8 October 2020

# Unstage a file
git reset --  src/sequelize-eparking/models/Fee.js

# Remove unused branches
git branch | grep 'feature/' | cut -c3- | xargs git branch -D

# See local and remote branches
git branch -v -a
master                                c313bf9 ...
remotes/origin/static-files-2         be32085 ...
remotes/origin/static-files-3         e9021d8 ...
...

# Checkout remote branch.
git checkout -b static-files-3 remotes/origin/static-files-3

# Latest commit > stage
git reset HEAD^
git checkout upstream/develop composer.lock

git config --global core.editor "vim"
git config --global user.name "name"
git config --global user.email "name@mydomain.com"
git config --local user.name "name"
git config --local user.email "name@mydomain.com"

# Check why a file was ignored.
git check-ignore -v config.php
# Get commits count of someone.
git log --author='Me' --since='2019-01-01' --before='2019-12-31' | grep '^commit'
git log --author='Me' --since='2019-01-01' --before='2019-12-31' | grep '^commit' | wc -l
git diff 980b^ 980b | grep '^+[^+]' | wc -l
git diff 980b^ 980b | grep '^-[^-]' | wc -l
git diff 980b^ 980b | grep '^+++' | wc -l

https://docs.github.com/en/github/extending-github/git-automation-with-oauth-tokens