What is git
Version control

What is Git

  • Git is a commonly used tool to aid with implementation of version control. It allows multiple team members to make changes at the same time and then merge them into 1.
  • Git is fast and modern
  • And it provides a full history of all changes
  • It doesn't need a complicated setup
  • Designed for team collaboration
  • you can sign up for a free git repo at either binbucket or github

Version control

helps provides clarity on:

  • When
  • Why
  • Contents of the change


Set up Git on your machine

1) mkdir /path/to/your/project # mkdir -p /root/bitbucket
2) cd /path/to/your/project # cd /root/bitbucket
3) git init # creates a .git folder
4) git remote add origin
4b)git config --list # to see the variables including step 4

Create your first file, commit, and push

5) echo "abc" >> contributors.txt
6) git add contributors.txt
7) git commit -m 'Initial commit with contributors' #commits to your local repo
8) git push -u origin master # or git push origin upload change from local to remote repo

git log # see what has been happening
git log --stat # a more detailed look at the log
git status # check status

add another file

9) echo "123" > 123.txt
10) git add *
11) git commit -m "upload all"
12)git push -u origin master

to download any new changes

13) git clone # will download it to pwd/commands/

on a different machine

14) mkdir binbucket
15) cd binbucket
16) git init # creates a .git repo
17) git remote add origin # adds
18) git clone # clones repo
19) cd commands
20) make a change to a file (in this case 123.txt)
21) git add 123.txt
22) git commit -m "123.txt edited"
23) git push -u origin master

back to the old machine

24) cd commands
25) git pull #for an update
26) cat 123.txt