Snippets Collections
usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]

These are common Git commands used in various situations:

start a working area (see also: git help tutorial)
   clone             Clone a repository into a new directory
   init              Create an empty Git repository or reinitialize an existing one

work on the current change (see also: git help everyday)
   add               Add file contents to the index
   mv                Move or rename a file, a directory, or a symlink
   restore           Restore working tree files
   rm                Remove files from the working tree and from the index
   sparse-checkout   Initialize and modify the sparse-checkout

examine the history and state (see also: git help revisions)
   bisect            Use binary search to find the commit that introduced a bug
   diff              Show changes between commits, commit and working tree, etc
   grep              Print lines matching a pattern
   log               Show commit logs
   show              Show various types of objects
   status            Show the working tree status

grow, mark and tweak your common history
   branch            List, create, or delete branches
   commit            Record changes to the repository
   merge             Join two or more development histories together
   rebase            Reapply commits on top of another base tip
   reset             Reset current HEAD to the specified state
   switch            Switch branches
   tag               Create, list, delete or verify a tag object signed with GPG

collaborate (see also: git help workflows)
   fetch             Download objects and refs from another repository
   pull              Fetch from and integrate with another repository or a local branch
   push              Update remote refs along with associated objects
- git init         #Initialise locat repositiry
- git add <file>   #Add files to index
- git status       #Check status of working tree
- git commit       #Commit changes in index
- git push         #Push to remote repository
- git pull         #Pull latest from remote repository
- git clone        #Clone repository into a new directory
##-----------------------------------------------------------------------------
1. Configure
- git config --global user.name 'Ian Horne'
- git config --global user.email 'ian@ihorne.com'
##-----------------------------------------------------------------------------
2. File to staging
- git add <file name> #Add file 
- git rm <file name>  #Remove file
- git add *.py        #Add all .py files to staging area
- git add .           #Add all files in directory to staging area
##-----------------------------------------------------------------------------
3. Commit staging area to your local repository
- git commit -m "your comments"
##-----------------------------------------------------------------------------
4. Ignore file
- create .git ignore file <touch .gitignore> 
- enter file or folder into .gitignore file to exclude it from the repository 
   -Add file           - <file.ext>
   -Add directory      - </dirname> 
   -Add all text files - <*.txt>
##-----------------------------------------------------------------------------
5. Branches - https://www.atlassian.com/git/tutorials/using-branches
- git branch <branch_name>    #Create branch
- git checkout <branch_name>  #move to branch
- git add <filename>          #add file change to branches
- git commit -m "comments"    #commit file and add comments
- git checkout <master>       #move to main branch
- git merge <branch name>     #merge branch into current branch location
- git push                    #push branch to hub
- git branch -d <branch>      #delete branch

##-----------------------------------------------------------------------------
6. Remove repositories
- Create new repository
- git remote                #list all remote repositories
- git remote add origin https://github.com/Ianhorne73/WageReport.git
- git push -u origin master
##-----------------------------------------------------------------------------
Future workflow
- change file
- git add .
- git push
##-----------------------------------------------------------------------------
Clone repository 
- git clone <get link from GIT hub>  #Clone repository from GIT Hub
- git pull                           #Get latest updates
- create a new repository on the command line
    git init
    git add README.md
    git commit -m "first commit"
    git branch -M main
    git remote add origin <HTTPS>
    git push -u origin main

- push an existing repository from the command line
    git remote add origin https://github.com/ramdaniAli/backupApp.git
    git branch -M main
    git push -u origin main
$ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
bookmark
dashboard

Mon Oct 26 2020 07:36:25 GMT+0000 (UTC)

#git #help
bookmark
dashboard

Mon Oct 26 2020 04:28:26 GMT+0000 (UTC) https://www.youtube.com/watch?v=SWYqp7iY_Tc

#git
bookmark
dashboard

Mon Oct 05 2020 13:23:12 GMT+0000 (UTC)

#git
bookmark
dashboard

Sun Jan 12 2020 17:26:19 GMT+0000 (UTC)

#commandline #git
bookmark
dashboard

Wed Dec 25 2019 18:55:34 GMT+0000 (UTC) https://help.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository

#commandline #git #github #howto

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension