User Tools

Site Tools


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
git [2026/07/08 22:43] – [checkout] jhagstrandgit [2026/08/06 07:54] (current) – [repository] jhagstrand
Line 52: Line 52:
 === bare=== === bare===
 a bare repository is a folder named project.git\\ a bare repository is a folder named project.git\\
-a non-bare repository is a subfolder named .git, co-residing in the project folder along with the working copy\\+a non-bare repository is a sub-folder named .git, co-residing in the project folder along with the working copy\\
  
-  git init +  git init  # executed from within a new project folder, creates the .git folder 
-  git clone+  git init --bare flash.git  # create a new sub-folder named flash.git   
 +   
 +  git clone <server.path>.flash.git # create sub-folder named flash, within which lies the .git sub-folder
  
 ====remote==== ====remote====
Line 329: Line 331:
 By default diff compares all of the currently modified files. By default diff compares all of the currently modified files.
  
-  git diff         # before the add +  git diff           # before staging 
-  git add . +  git add .          # staging 
-  git diff HEAD    # after the add+  git diff HEAD      # after staging 
 +  git diff --staged  # after staging
  
 Additional options. Additional options.
Line 383: Line 386:
  
 https://www.sitepoint.com/git-interactive-rebase-guide/ https://www.sitepoint.com/git-interactive-rebase-guide/
 +
 +==== Combinations ====
 +
 +Some git command options effectively execute multiple git commands simultaneously.
 +Here are some examples.
 +
 +  1. git add .
 +  2. git commit -m 'latest fix'
 +  1+2. git -a commit -m 'latest fix'      # combine add and commit
 +
 +  1. git clone <project>
 +  2. git submodule init
 +  3. git submodule update
 +  2+3. git submodule update --init
 +  1+2+3. git clone --recursive-submodules <project> 
 +
 +  1. git fetch     # download patch files
 +  2. git merge     # apply patches to local files
 +  1+2. git pull    # fetch and merge
 +
 +====Fork====
 +In github ui, fork repo from voyc to hagstrand.  A fork is a server-side clone.
 +
 +Locally:
 + git clone xttps://github.com/hagstrand/flash flashbang   # specified target <directory>
 + git remote add upstream xttps:github.com/voyc/flash   # second remote
 + git pull --rebase upstream master   # pull changes from upstream, update local, no commit
 + # pull does a fetch and merge into local directory.  No need to commit.
 + git push origin master   
 + Todo: Rename?
 + Todo: In github UI, “Pull Request” to bring forked project back into upstream.
 +
 +
 ===== How to use ===== ===== How to use =====
  
Line 664: Line 700:
  git submodule update --init   # copies entries from .gitmodules to .git/config, and pulls each  git submodule update --init   # copies entries from .gitmodules to .git/config, and pulls each
  
-==== Combinations ==== 
- 
-Some git command options effectively execute multiple git commands simultaneously. 
-Here are some examples. 
- 
-  1. git add . 
-  2. git commit -m 'latest fix' 
-  1+2. git -a commit -m 'latest fix'      # combine add and commit 
- 
-  1. git clone <project> 
-  2. git submodule init 
-  3. git submodule update 
-  2+3. git submodule update --init 
-  1+2+3. git clone --recursive-submodules <project>  
- 
-  1. git fetch     # download patch files 
-  2. git merge     # apply patches to local files 
-  1+2. git pull    # fetch and merge 
- 
-====Fork==== 
-In github ui, fork repo from voyc to hagstrand.  A fork is a server-side clone. 
- 
-Locally: 
- git clone xttps://github.com/hagstrand/flash flashbang   # specified target <directory> 
- git remote add upstream xttps:github.com/voyc/flash   # second remote 
- git pull --rebase upstream master   # pull changes from upstream, update local, no commit 
- # pull does a fetch and merge into local directory.  No need to commit. 
- git push origin master    
- Todo: Rename? 
- Todo: In github UI, “Pull Request” to bring forked project back into upstream. 
  
-====See the current changes==== 
- git diff  # before staging (git add *) 
- git diff --staged # after staging 
  
 ==== Remove a submodule ==== ==== Remove a submodule ====
git.1783565029.txt.gz · Last modified: 2026/07/08 22:43 by jhagstrand

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki