@AlexNiderbergiOS and Android Reliability Engineering - Capital One
Source: Linus 2007 Git Introduction
Using CVCS penalizes you from committing and branching since it is so expensive. This causes developers to have very large commits.
Git stores information about your project in .git subdirectory referred to repository
git cat-file -p master git cat-file -p a7ba36a62d8d8a40d4d9bc4386cc1ae174aff555 cat-file -p cfcae178cfcf1948c2aca252ebed8146c8aada4f
When initializing a git repo the default branch is master
(1) -- (2) -- (3) | master | HEADHEAD points to commit (3) on master branch
#Switching branches $ git checkout [branch-name]
/Users/xvo202/Development/animationDemo/loginexamplesThis repo should have the demo, pull and confirm https://bitbucket.org/aln787/flightinfo
git tag v0.3.8 git tag v0.3.8 44a2a4a2bf8b85214551ce93227d4af7981e8eca git tag --list git push --tags git push origin v0.3.8
Distributed version control model to collaborate between multiple developers.
Remote repositories are versions of your project that are hosted on the Internet or network somewhere.
$ git clone [git-remote-repo-url].git
Create new repository on github or bitbucket On your local machine..
$ git remote add origin [git-remote-repo-url].git $ git push -u origin master
origin is a remote repository reference that git uses
$ git pull [remote-repo-reference] [remote-branch-name] $ git pull origin master
$ git push [remote-repo-reference] [remote-branch-name] $ git push origin master
origin https://github.com/aln787/git-collab.git (fetch) origin https://github.com/aln787/git-collab.git (push) 14109fd767af:git-collab xvo202$ git remote add kdc https://github.kdc.capitalone.com/xvo202/git-collab.git 14109fd767af:git-collab xvo202$ git remote -v kdc https://github.kdc.capitalone.com/xvo202/git-collab.git (fetch) kdc https://github.kdc.capitalone.com/xvo202/git-collab.git (push) origin https://github.com/aln787/git-collab.git (fetch) origin https://github.com/aln787/git-collab.git (push)
While pulling or merging a branch merge conflicts can occur due to conflicting changes
#git diff [ --staged | --cached ] $ git status # At least 1 file is staged $ git diff --staged # Reveals the staged changes $ git reset #to push those changes back to the working copy
#git add --patch [file] $ git add --patch #Use s for smaller y, n, ...
#git [command] --help or man git $ git diff --help $ man git # Then use / to search for --ca
$ ls -al ~/.ssh $ ssh-keygen -t rsa -b 4096 -C "youremail@email.com" $ eval "$(ssh-agent -s)" $ ssh-add ~/.ssh/id_summit2016 $ cat ~/.ssh/id_summit2016.pubThen add the output of the cat to your list of github ssh keys on the github site.
$ ssh -T git@github.comFull Set-up details
- (Y-Combinator project acquired by Drop Box)
- Status - Init - Clone - Diff - Commit
$git status fatal: Not a git repository (or any of the parent directories): .git
$ mkdir [project-name] $ cd [project-name] $ git init
git-collab/ .git/ config description HEAD hooks/ info/ objects/ refs/
$ git clone [git-url] $ git clone https://github.com/vmaliwal/git-collab.git
$ git status On branch master Your branch is up-to-date with 'origin/master'. Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: README.md modified: index.html Untracked files: (use "git add <file>..." to include in what will be committed) images/CentralizedVCS.png images/DistributedVCD.png images/LinusViewDVCS.png no changes added to commit (use "git add" and/or "git commit -a") </file></file></file>
$ git diff README.md diff --git a/README.md b/README.md index f08ca69..10ea20b 100644 - a/README.md + b/README.md @@ -1 +1,9 @@ -### Introduction to Git \ No newline at end of file +### Introduction to Git + +- run +``` +npm install +grunt serve +``` + +- Make changes by modifying index.html \ No newline at end of file
Create a new file or modify existing
$ echo "Introduction to Git" > README
$ git status # On branch master # # Initial commit # # Untracked files: # (use "git add [file]..." # to include in what will be committed) # # READMEWhen creating a new file or updating existing file and saving those changes will create a commit object
$ git add [file-name] $ git commit -m "Initial commit"
$ git add . //to add all modified files, or $ git commit -a -m "Initial commit"
Git commit -a #is the same as using git add and then git commit git config --global color.ui true