User Tools

Site Tools


notes:git

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
notes:git [2023/08/31 11:21] azmannotes:git [2024/02/28 09:54] (current) – [Create/Apply Patches] azman
Line 1: Line 1:
 ====== Git Stuff ====== ====== Git Stuff ======
  
-From [[http://git-scm.com|here]],+From [[https://git-scm.com|here]],
  
 //"Git is an open source, distributed version control system  designed to handle everything from small to very large projects with speed and efficiency."// //"Git is an open source, distributed version control system  designed to handle everything from small to very large projects with speed and efficiency."//
  
-Some useful configurations before starting with git. I have this simple script that I run on a new machine I want to work on. +Some useful configurations before starting with git. I have this [[https://codeberg.org/azman/my1shell/src/branch/master/gitstart|simple script]] that I run on a new machine I want to work on.
-<file bash gitstart> +
-#!/bin/bash +
- +
-# gitstart +
-# - written by azman@my1matrix.net +
-# - write basic git config setup +
- +
-GIT_NAME=${GIT_NAME:="Azman M. Yusof"+
-GIT_MAIL=${GIT_MAIL:="azman@my1matrix.net"+
- +
-git config --global user.name "$GIT_NAME" +
-git config --global user.email "$GIT_MAIL" +
-git config --global color.diff auto +
-git config --global color.status auto +
-git config --global color.branch auto +
-git config --global color.ui auto +
-# only on slackware? some viewing problems (less environment?+
-git config --global core.pager "less -FXRS" +
-</file> +
- +
-Note: Set the environment variable //VISUAL// to your favorite console editor... I use $(which vim). OR, use <code>$ git config --global core.editor "vim"</code>+
  
 ===== Create, Clone, Add, Commit ===== ===== Create, Clone, Add, Commit =====
Line 47: Line 26:
 Create formatted patches (note: sha1id1..sha1id2 is the range of commits used to create patches) <code>$ git format-patch -o /path/to/patches/ sha1id1..sha1id2</code> Create formatted patches (note: sha1id1..sha1id2 is the range of commits used to create patches) <code>$ git format-patch -o /path/to/patches/ sha1id1..sha1id2</code>
 To rename created patch(es) with commit timestamp <code> for a in *.patch ; do l=$(cat $a|grep 'Date: ') ; d=$(date +"%Y%m%d%H%M%S" -d "${l#*: }") ; mv $a "$d${a:4}" ; done</code> To rename created patch(es) with commit timestamp <code> for a in *.patch ; do l=$(cat $a|grep 'Date: ') ; d=$(date +"%Y%m%d%H%M%S" -d "${l#*: }") ; mv $a "$d${a:4}" ; done</code>
-To apply the patches (stopping on error) <code>for a in ~/temp/patch/*.patch ; do git am <$a ; [ $? ne 0 ] && break; done</code>+To apply the patches (stopping on error) <code>for a in ~/temp/patches/*.patch ; do git am <$a ; [ $? -ne 0 ] && break; done</code>
  
 ===== Branching/Merging ===== ===== Branching/Merging =====
notes/git.1693452085.txt.gz · Last modified: by azman