Skip to content

jonhoffmam/git_beginner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo Git

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Git is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.

By: Git

Icon Git Install/Update

  • Windows-Icon Windows

Download latest source release

  • Mac-Icon Mac OS

Download latest source release

  • Ubuntu-Icon Ubuntu Debian
$ sudo add-apt-repository ppa:git-core/ppa -y
$ sudo apt-get update
$ sudo apt-get install git -y
  • Linux-Icon Other

Access the list here

Commands (All)

Setup-Icon Setup and Config

  • config - Get and set repository or global options

Open the terminal and type the commands:

Username:

$ git config --global user.name "your_name"

E-mail:

$ git config --global user.email "your_email"

Editor:

$ git config --global core.editor "your_fav_editor"

Git config editor:

Editor Config Command
VS Code $ git config --global core.editor "code --wait"
Atom $ git config --global core.editor "atom --wait"
emacs $ git config --global core.editor "emacs"
nano $ git config --global core.editor "nano -w"
vim $ git config --global core.editor "vim"
Textmate $ git config --global core.editor "mate -w"
Sublime Text (Mac) $ git config --global core.editor "subl -n -w"
Sublime Text (Win x86) $ git config --global core.editor "'c:/program files (x86)/sublime text 3/sublimetext.exe' -w"
Sublime Text (Win x64) $ git config --global core.editor "'c:/program files/sublime text 3/sublimetext.exe' -w"

Display settings:

$ git config <key>

Example:

$ git config user.name
$ git config user.email 
$ git config --list

Get-Icon Getting and Creating Projects

  • init - Create an empty Git repository or reinitialize an existing one
$ git init
  • clone - Clone a repository into a new directory
$ git clone <repository>

Basic Snapshotting

  • satus - Show the working tree status
$ git status
  • add - Add file contents to the index

One file:

$ git add <file_name>

All files:

$ git add *
  • rm - Remove files from the working tree and from the index

One File:

$ git rm --cached <file_name>

All files:

$ git rm --cached *
  • commit - Record changes to the repository
$ git commit -m "comment"
  • reset - Reset current HEAD to the specified state
$ git reset HEAD <file_name>

Branch-Icon Branching and Merging

  • branch - List, create, or delete branches
$ git branch

Create a new branch with checkout:

$ git checkout -b <branch_name>
  • log - Show commit logs
$ git log <options>
  • checkout - Switch branches or restore working tree files
$ git checkout <file_name>

Inpection-Icon Sharing and Updating Projects

  • push - Update remote refs along with associated objects
$ git push

Inspection and Comparison

$ git shortlog <options>
  • diff - Show changes between commits, commit and working tree, etc
$ git diff <options>

Key-Icon Generating a new SSH key and adding it to the ssh-agent

  1. Open your terminal
  2. Paste the command below, substituting in your GitHub email address
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
  1. Press Enter for this accepts the default file location
> Enter a file in which to save the key (/c/Users/you/.ssh/id_rsa):[Press enter]
  1. Type a secure passphrase and confirm (optional)
> Enter passphrase (empty for no passphrase): [Type a passphrase]
> Enter same passphrase again: [Type passphrase again]
  1. Enter the folder containing your key (default path is .ssh)
$ cd ~/.ssh
  1. Get the key from the id_rsa.pub file with the command below
With cat command:
$ cat id_rsa.pub
With more command:
$ more id_rsa.pub

About

Knowing the concept of version management (versioning), using and testing GIT.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published