Skip to content

Instantly share code, notes, and snippets.

@edoves
Last active December 7, 2019 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edoves/752e679fb6bbbf772fe5915660ab962d to your computer and use it in GitHub Desktop.
Save edoves/752e679fb6bbbf772fe5915660ab962d to your computer and use it in GitHub Desktop.
# From Kal Skills Teaching procces on cloning a existing repository or want to colaborate with it
git clone - clone a repository
cd - change directory
ls - list directory
git status - mostly for verification
git add filename
git commit -m "waht ever message here"
git push
upstream
origin
git remote -v
git branch dev
git checkout dev
switch to branch dev
git remote add upstream "repository"
git pull upstream master
#######################################
# Git and GitHub LiveLessons - Workshop
# 01 - Configuring Git
# 02.Three levels of configuration
# global
# local
# system
Lynda taught
System
/etc/gitconfig
Proram Files\Git\etc\gitconfig
# if its system level
git config --system
User
~/.gitconfig
$HOME\.gitconfig
# if its local of user level
git config --global
Project
my_project/.git/config
# if its project level
git config
# 03.Basic configuration settings
git config --global user.name
example: git config --global user.name "Daffy Duck"
git config --global user.email
example: git config --global user.email "daffy@disney.com"
to see or check in list the config file
git config --list
git config --global --edit
You can use the --unset flag of git config to do this like so:
git config --global --unset user.name
git config --global --unset user.email
If you have more variables for one config you can use:
git config --global --unset-all user.name
Output the content of a file
cat ~/.gitconfig
to edit the .gifconfig file in windows
nano ~/.gitconfig
to edit the .gifconfig file in windows
vi ~/.gitconfig
List all your git global configuration
git config --global --list
command to give coloration when run different command it will give you red or green
git config --global color.ui true
# 04.Configuring line endings
on windows
git config --global color.autocrlf true
on mac os
git config --global color.autocrlf input
# 05.Configuring aliases
# aliases in git allows you to make up your own commands using of bunch of options so its easier and quiquer to work with
git config --global alias.s "status -s"
git config --global alias.lg "log --oneline --all --graph --decorate"
# Chapter 2 Getting Started with Git
initialise a we1 folder
git init web1
git add
you can select a file to add to the staging area by doing
git add ab*
it will select the character that start with ab on the file name
git log --oneline
git log --oneline --decorate
press q to get out of the log command
# Chapter 4 Files in Git - Renaming, Deleting and Ignoring
How to rename a file in git
git mv index.html home.html
other way
mv index.css home.css
Deleting a file in git
# two options on deleting files use git to delete a file or we can delete a file then tell git
git rm contact.html
rm contact.css
.gitignore file
!special.log meaning do not ignore special.log
# Chapter 5 Branching, Merging and Rebasing
commit and add in one command but wont work to untrack files
-am mean add as well as commit
git commit -am
Branching
To check to see the branches
git branch
To create a new branch
git branch newbranchname
To switch to branches that has bean created
git checkout branchname
difference about clone and fork
if you never want to contirubute changes back you dont need to fork just clone it
if its a repository of one of yout friends ot coworker and they added you as a colaborator you dont need to fork it just clone it and push it back the changes you just made
if got a project where you dont know the people who created it and you want to contribute your changes back
you gonna have to pork that repository
echo -> command to create a file at the same time write pharases into it
echo "Front-end project for kal skills" >> README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment