A Free Open Source DVCS ”distributed version control system ”
-
- Compares SHA1 sum of modified files.
- Saves the new file as a Whole "easier to retrive lost data"
- Each Snapshot contains references to the files "to save space uses ref. only"
-
-
-
- Each Computer has all the history of the project
- Makes it faster and easeir to contribute
- Safer beacuase the data are not onlt on one repo
-
- Everything in Git is CHECKSUMMED "fast ,reliable"
- Uses SHA-1 hash "a 40 hexadecimal char string"
- Easy to recognize corrupted files.
- Modified
- Staged
- Committed
$ sudo apt update
$ sudo apt intsall git
git config --global user.name "John Doe"
git config --global user.email [email protected]
git config --global core.editor nano
git config --global merge.tool meld
git has a really good command manual for each command
$ git help <command>
$ man git <command>
$ git <command> -h #summarized
- Repository
- Index “Staging area”
- working tree “Project tree”
- Commit
- Branch
- Tag
- Master
- Head
$ git init # Intialize a Embty/new repository
$ git clone <URL># to Clone/Copy exsiting repository
<URL>
: can be git, shh, http, https, file , etc
-
-
$ git status` $ git status -s # Summarized
??
“ untraked ”- A “ staged ”
- M “ Modified staged “
M
“ Modified untracked “ Example:
$ git status $ echo 'I' > README #creates a new file $ git status
-
Stage your files after adding not before
Example:
$ git add <files|WildCards>
$ git add README $ git status $ echo “USE” >> README $ git status $ git add README $ git status
-
A file listing patterns to match them with files in your repositories.
File name “.gitignore”
- .gitignore
common templates
- See
man gitignore
for more information
- .gitignore
-
-
$ git status $ git diff #diffreneces between commited and modified/untracked $ git diff --staged #diffreneces between commited and modified/tracked/staged
Example 1
$ git commit -am “cleaning the stage” $ echo “Git” >> README $ echo “Git” > Cont.md $ git add README Cont.md $ git diff # $ echo “OSC” > Cont.md $ git status $ git diff
Example 2
$ git commit -am “cleaning the stage” $ echo “1” > file $ git add file && git commit -m “new file” $ echo “2” > file $ git add file $ echo “3” >file $ git diff $ git diff --staged
-
Example
git commit git commit -m "short Message" git commit -am “Your Message” #Stage all untracked files and commit all files in staged area
$ git commit -am “cleaning the stage” $ echo “1” > newfile $ git commit -am “new file” $ git status $ git add newfile && git commit -m “new file” # Change “newfile” and try using commit -am “changed new file”
-
git rm <file name| wild card>
-
git mv <file name| wild card>
-
$git log $ git log -p $ Git log -<number> $ git log --since <date> $git log --until <date>
<data>
or<number>
EX : “ 2008-01-15” or EX : "2 years 1 day 3 minutes ago"
-