Git and Github.com another post codewithharry.com

 One of Best and Easiest Training better than paying Traning on Git and GitHub.com is with codewithHarry.com for who undertand URDU / HINDI for Pakistanis and Indians 

My suggestion is to speed video with speed of 1.25x or 1.5x

https://www.youtube.com/watch?v=evknSAkUIvs&list=PLu0W_9lII9agwhy658ZPA0MTStKUJTWPi

What is Git/GitHub & Why do we need it? | Git Tutorials #1

• Git is software for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data integrity, and support for distributed, non-linear workflows. • Git advantage ○ Easily recover files ○ Who introduced an issue and when ○ Rollback the code to a working previous state • Feature ○ Fast ○ Capture the snapshot, not the difference ○ Almost every operation is local (no internet required) i.e. all operations are performed on locally and after that can push the repo to a remote (centralized server). ○ Git has integrity i.e all the changes are tracked and need approval for merging. Has SHA1 checksum to validate the files. Git generally only adds data


@ History of Git.
    Mr. Linus who is working on Linux needs VCS so used third party free of cost VCS but suddenly the company
    ask for huge amount but Linus was not prepared to pay. So he started to invent his own VCS git with help
    of his software team

    3 Type of VCS
    1. Local VCS (saved/record software/contents of any thing locally on Local computer's Local Hard disk )
    2. Centrally controlled VCS (saved/recorded on one Central computer it better than above)
    3. Distributed Controlled VCS (To save/record the software/contents on Central computer as well as on Local Hard of             Local computer )

Features of Git
    1. caputre Snapshots not only differences
            git save whole project history in .git folder
            you restore the project of any time from .git folder using git commands
    2. Almost every operation is local
    3. Integrity of Files/backup/versions of the software . having checksum 14 characters Hash Code using SHA1
            means if any one change the file then its checksum will not match with given file
    4. Git generally adds the data, as amend or delete some lines from file git will add the snapshots of file

$ git config user.name 'SAEED HASSAN'
$ git config user.email 'saeedhaistabni @ yahoo.co.uk








video No 4





$ git init  
Initialized empty Git repository in F:/GIT/.git/

$ git add first.txt     &&& to transfer file from Untracked/working directory to Stage Area , Stagging area

$ git commit first.txt -m 'changed first.txt and added better design'

$ git log  && following will be out 
commit 3daf1bf3398e58033f4659d1f6daab7d84968c3c (HEAD -> master)
Author: SAEED HASSAN <saeedhisbani@yahoo.co.uk>
Date:   Fri Sep 22 16:33:20 2023 +0500

    modified excel

commit 11a8a3652a4a0b4a85b9371d1eee59ed7a7d4b15
Author: SAEED HASSAN <saeedhisbani@yahoo.co.uk>
Date:   Fri Sep 22 16:30:13 2023 +0500

    changed first.txt and added better design

commit 30d797a3dab427e268a0573873617e328d547581
Author: SAEED HASSAN <saeedhisbani@yahoo.co.uk>
Date:   Fri Sep 22 16:20:08 2023 +0500

    Initial Commit

Saeed Hassan Hisbani@Saeed-PC MINGW64 /f/GIT (master)
$
 
video No 5

To remove whole git repositry 

$ rm -rf .git

 video No 6


Any new file added in .git reposity/dir it UNTRACKED File
$ git add newfile will became TRACKED FILE Unmodifield
When we modify any Staged File status will be MODIFIED      STAGED file 
 if we modify Commit (ed) file then      it will be MODIFIED UNSTAGED file
All statuses will be apparantly seen on the screen messages of git no need to remember

 video No 7     .gitignore: Ignoring Files in Git 

for ignore any file add in vi .gitignore doc as
*.log means all .log file
dir/  means all files in dir/ directory and also ignore dir/dir/ files. 
empty folder is befault is in ignore condition

video No 8   Git Diff: Showing Changes Between Commits/Staging Area & Working Directory  

1. first modified t file



Then we again modified same file t after adding it in stage area 


$ git diff   without further aurgument by default compare unstaged and staged versions
of same file as in case file name t
In other more technical words:
$ git diff compare the same file of working directory and stage directory/area

$ git diff --staged
The above command will compare staged area file with commit(ed) area same corresponding files 


Git: Skipping The Staging Area | Git Tutorials #9
https://www.youtube.com/watch?v=epGcuDu3z7k&list=PLu0W_9lII9agwhy658ZPA0MTStKUJTWPi&index=9

Any new file added in .git reposity/dir it UNTRACKED File
$ git add newfile will became TRACKED FILE Unmodifield
When we modify any Staged File status will be MODIFIED      STAGED file 
 if we modify Commit (ed) file then      it will be MODIFIED UNSTAGED file
All statuses will be apparantly seen on the screen messages of git no need to remember

$ git commit -a  -m 'Commit by skipping stage area' 

Note: above command will not commit the UNTRACKED Files
It will commit all the old TRACKED file. means if you modified old commit (ed)
1....many files all  TRACKED file will be commit ed with one command

https://www.youtube.com/watch?v=1t56nLJJbMU&list=PLu0W_9lII9agwhy658ZPA0MTStKUJTWPi&index=10

Instead of directly removing file in git repo you use 

$ git rm <filename>

This command will send file in stage area,

$ git mv <filename>  <newfilename>

This command will also send to stage area

Note: if you add commit (ed) file in .gitignore it will not  be ignored utill and unless 
you untracked it by command

$ git rm --cached  <filename>

Note that this command will not remove the file physically. It will be removed only from
tracking by git. means Git will ignore it  

https://www.youtube.com/watch?v=Hxn3OguEMd4&list=PLu0W_9lII9agwhy658ZPA0MTStKUJTWPi&index=11

Saeed Hassan Hisbani@sad MINGW64 ~
$ git clone https://github.com/panada/panada.git mypanda
Cloning into 'mypanda'...
remote: Enumerating objects: 4859, done.
remote: Total 4859 (delta 0), reused 0 (delta 0), pack-reused 4859
Receiving objects: 100% (4859/4859), 1.36 MiB | 240.00 KiB/s, done.
Resolving deltas: 100% (2456/2456), done.
Saeed Hassan Hisbani@sad MINGW64

$ git log
it also show add and removing lines












$ git log -p


$ git log --stat 

$ git log - -pretty=oneline


$ git log --pretty=short

$ git log --pretty=full

$ git log --since=2650.days

$ git log --since=2.weeks

$ git log --since=2.months

$ git log --since=2.years

$ git log --format = <formattypes>

$ git commit --amend        && it will open editor with first log entry

$ git commit --amend -m 'amend direclty'


https://www.youtube.com/watch?v=m08GSxWO1pQ&list=PLu0W_9lII9agwhy658ZPA0MTStKUJTWPi&index=12

To Discard changes before Stage a file  (Note this not in video)
$ git restore  <filename>


To restore file according to Last commit (ed)

$ git checkout -- <filename>


If we modified 50 files and we want restore/revert changes of all 50 files 
we run 
$ git checkout -f















Comments

Popular posts from this blog

PANDAS micro course by www.Kaggle.com https://www.kaggle.com/learn/pandas

Course No 2 Using Python to Interact with the Operating System Rough Notes

Introduction to Git and GitHub https://www.coursera.org/learn/introduction-git-github/