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/12/14 06:57] – [Git Stuff] 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 [[https://codeberg.org/azman/my1shell/src/branch/master/gitstart|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.
- 
-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 28: 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.1702508263.txt.gz · Last modified: by azman