Differences

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


Previous revision
fuss:git [2017/02/22 18:30] – external edit 127.0.0.1
Line 1: Line 1:
-====== Generate Patches ====== 
- 
-<code bash> 
-git add some_file 
-git commit -m "Commit message that will show in patch." 
-git format-patch -1 
-0001-Commit-message-that-will-show-in-patch.patch 
-</code> 
- 
-====== Undo Last Commit ====== 
- 
-Suppose the following incremental patches from ''A'' to ''B'': 
- 
-<ditaa> 
-A - B - C 
-        ^ 
-        | 
-      master 
-</ditaa> 
- 
-to delete ''C'', one would issue: 
- 
-<code> 
-git reset --hard HEAD~1 
-</code> 
- 
-the result is the following: 
- 
-<ditaa> 
-A - B 
-    ^ 
-    | 
-  master 
-</ditaa> 
- 
-another ''git reset --hard HEAD~1'' would yield: 
- 
-<ditaa> 
-A 
-^ 
-| 
-master 
-</ditaa> 
- 
-====== Roll Back to Commit ID ====== 
- 
-<code bash> 
-git reset --hard e484904 
-</code> 
- 
-or for SHA: 
- 
-<code bash> 
-git reset --hard 3f786850e387550fdab836ed7e6dc881de23001b 
-</code> 
- 
-====== Rebase ====== 
- 
-Rebasing is good when local changes are not important enough to be merged into the main development branch. The procedure is as follows: 
- 
-  * Clone the repository and switch to your new branch, let's say the new branch should be ''mybranch'' and assume that the parent branch is named ''master'': 
- 
-<code bash> 
-git clone https://github.com/repo -b mybranch 
-</code> 
- 
-  * Next, you can make the changes to the code, and apply any patches you wish. 
-  * Issue: 
- 
-<code bash> 
-git config --global --bool pull.rebase true 
-</code> 
-to globally turn on rebasing. 
- 
-  * On the next pull, with ''git pull repo master'', the changes should be merged in and your patches applied //on top// of the pull, effectively merging the changes. 
- 
-====== Set Name and E-mail ====== 
- 
-<code bash> 
-git config --global user.name "John Doe" 
-git config --global user.email john@example.org 
-</code> 
- 
-====== Ignore Local Changes ====== 
- 
-If you get the following error when doing a ''git pull'': 
- 
-<code> 
-Please, commit your changes or stash them before you can merge. 
-</code> 
- 
-and you do not want to stash the changes, simply issue: 
- 
-<code bash> 
-git reset --hard 
-git pull 
-</code> 
- 
-to overwrite any local changes. 
  

fuss/git.txt · Last modified: 2022/04/19 08:28 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.