Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions sarah-paetsch/git_notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
Git Basics

*** Ideas ***

version control, source control, revision control

repository
commit changes to repository

why git?
designed by linux creator to manage development of that OS

distributed version control system
access to "plumbing"
github community

.git folder is where the history is stored

master branch is trunk

remote repositories
clone
push and pull


*** Commands ***

git --version find out what version is installed

git init <name> create repository called <name>
git init creates a new repository based on the current directory

rm -r .git delete .git folder, which also removes repository

git config --global user.name "<name>" to set info re: user, for contact with team
git config --global user.email "<address>"

git add <filename> add file to repo, adds to staging area
git commit commits file to repo, launches text editor to write comment
git commit -a -m "<text>" commits all changed files with <text> as comment

git status status of files that are in progress
git log shows history of commits in repo

git checkout <id> checkout commit from history, identified for 1st six chars of ID

git diff <id1> <id2> compare two commits

git branch <bname> create a branch called bname
git checkout <bname> switch to that branch, checkout its head
git checkout -b <bname> create branch called bname and check it out
git branch lists all branches in project and shows which is current
git branch -D <bname> deletes the branch called bname.

git merge <bname> merge bname into branch you are currently on,
will work automatically if there are no conflicts
if detects conflict, will fail and notify
proceed by opening file in conflict, inspect markers, choose change, save. run git add and git commit to add changes and resolve conflict.

git clone <loc> make a local copy of the repo at loc


git remote shows the remote repository for the one you're currently in
if it is a clone, the copied repo will be called origin

git remote add <name> <loc> add a remote called name found at location loc

git push send all changes from current repo to remote
git push origin <bname> add new branch called bname to origin

git pull origin <bname> pull from origin to bname branch
can be used to resolve and merge locally first, just like merge

assumes origin remote for push and pull


*** GitHub ***
pull request - ask owner to pull in your changes
fork - make your own copy


*** gitflow for branch management ***

git flow feature start <name> create a feature branch called <name>
git flow hotfix start <name> create a hotfix branch called <name>
git flow hotfix finish <name> close out the fix










146 changes: 146 additions & 0 deletions sarah-paetsch/unix_notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
*** Console Commands ***

ls list contents of directory
ls -l long form version, more details
ls -a list all, including hidden files
ls /<dir> list contents of that directory

clear clear screen

pwd print working directory

cd <dir> change directory,
cd ~ will go to home dir
cd .. will go one directory higher

mv <from> <to> move or rename, files or directories
cp <from> <to> like mv, but leaves original in place
-r to do so recursively, for directories
rm removes a file or directory, no undo
-r to do so recursively, for directories
mkdir make directory
-p to create nested directories

!! previous command


*** Looking at file contents ***

less <filename> runs “less” to show file contents, arrow to scroll, spacebar by page
q to quit. “pager”

cat <filename> for concatenating but can use to view contents

nano <filename> to view and edit. ctrl key menu at bottom


*** Users ***

whoami which user you're logged in as
sudo adduser <name> add user, in special mode
su <name> switch user
exit will go back to original user


*** Permissions ***

chmod <who> <what> change permissions
chmod o+w = give Others the write permission

chown <name> needs sudo, chgs ownwer

sudo switch to root user, super user


*** Processes ***

top shows current running processes, interactive
? will show help, like how to sort
q to quit

ps show processes, return list
aux view all processes
ps aux | grep "top" will show all processes that match the grep for top

jobs list jobs for current session, id's
<job> & run a process and immediately put it in background
fg bring most recently paused job back to foreground

kill <id> kill process with that id#, clean up and exit
kill -KILL <id> end immediately, can leave system in strange states
kill -STOP <id> sends stop signal (pause)



*** environment variables

env shows environment variables
echo <stuff> echo back stuff
echo $<enviro> will echo back value of environment variable
echo $HOME
$ specifies that you want to expand the env variable out
do not use $ when setting value
$PS1 prompt
export send variable to other processes
$PATH where it looks to run command, directory by directory



find . -name "<name>" starting in current directory, search down for file with name
returns path to file

grep search inside a file for a pattern (regexp)
grep "is" hello.txt search for "is" in file hello.txt
grep -n "is" hello.txt provides line numbers for search results
grep -i case insensitive
grep -v lines that don't match
man grep manual for all options for grep



*** installing ***
build and install from source vs. package manager

sudo apt-get update updates package database
sudo apt-get install <name> installs package
curl -O <file URL> copy file from online location
tar -xvf <file location> decompress tar at this location

1) ./configure run the configure program right here
2) make build program
3) sudo make install install


apt-cache search <x> search package database for search term
sudo apt-get upgrade check for updates
sudo apt-get remove <name> uninstall package

*** Other Notes ***

user | group | other: order of permissions
~ home directory
tab completion: shows autocomplete options for valid cd
bash: shell
read, write, execute: permissions
octal 0 thru 7 -- r=4, w=2, x=1

a job is a process that you own that you started from your console window
can pause/stop a job, ctrl-Z

signal: message sent to a process by an OS
signal: TERM : terminate, clean up and exit ctrl-C

standard in and standard out
piping output from one program as input to another with |
< redirection, route file into std input program
> output
>> redirect output to append to end of file
2> redirect std error output to file

find / -name "sudoers" 2> /dev/null dump errors into junk file

ps aux | grep bash | sort find all the processes called bash and sort them