
A repository is simply a database containing all the information needed to retain and manage the revisions and history of a project. Within a repository, Git maintains two primary data structures, the object store and the index.
The object store is designed to be efficiently copied during a clone operation as part of the mechanism that supports a fully DVCS.
Index is transitory information , is private to a repository and can be created or modified on demand as needed.
It contains your original data files and all the log messages, author information, dates, and other information required to rebuild any revision or branch of the project.
There are four types of Object stores
The index is a temporary and dynamic binary file that describes the directory structure of the entire repository.
Index captures a version of the project’s overall structure at some moment in time. As the developer, we execute Git commands to stage changes in the index. Changes usually add, delete or edit some files or set of files. The index records and retains those changes, keeping them safe until your are ready to commit them. You can also remove or replace changes in the index.
The Git object store is organized and implemented as a content-addressable storage system. Each object in the object store has a unique name produced by applying SHA1 to the contents of the object, yielding an SHA1 hash value. Any tiny change to a file causes the SHA1 hash to change, causing the new version of the file to be indexed separately.
SHA1 values are 160-bit value that are usually represented as a 40 digit hexadecimal number.
for example
937082042f48a5cbc7777634509310fff059bc19
Remote Repository(master) <-> Index(Staging happens here) <-> Local Repository (local)
Git’s Index doesn’t contain any file content: it simply tracks what you want to commit when you run git commit. Git checks the index rather than your working directory to discover what to commit.
You can query the state of the index at any time with the command git status
$ cd ~/.ssh
$ ssh-keygen -t rsa -C "your_email@example.com"
to copy the RSA key to the clipboard
$ clip < ~/.ssh/id_rsa.pub
add, bisect,branch, checkout,clone,commit,diff,fetch,grep,init,log,merge,mv,pull,push,rebase,reset,rm,show,status,
tag
git --version
git commit -m "commit message"
git commit --message="commit message"
git init
git add index.html
git status
git config user.name "abhishekluv"
git config user.email "abhishekluv@gmail.com"
git log
git show commitSHAnumber
git show-branch --more=10
git diff commitSHA#1 \ commitSHA2
git rm index.html
git mv index.html index2.html
git clone firstreponame secondreponame
git config --global user.name "abhishekluv"
git config --global user.email "abhishekluv@gmail.com"
Example
git add .gitignore
git add --all
git status
git commit -a
git commit --all
causes it to automatically stage all unstaged, tracked file changes - including removal of tracked files from the working copy before it performs the commit.
git rm index.html : will remove the file completely from the working directory as well as the remote repo
git rm --cached index.html : will remove the file from the index and leave it in the working directory
mv stuff newstuff
git rm stuff
git add newstuff
or
git mv stuff newstuff
add any file name in the .gitignore file which you want to ignore
In Git, a commit is used to record changes to a repository
git commit -m "message"
git commit --all -m "message"
A branch is the fundamental means of launching a separate line of development within a software project.
Git allows many branches and thus many different lines of development within a repository.
Creating a branch
git branch branchname
git branch
git show-branch
git checkout branchname
git checkout -b branchname
git branch -d branchname
In Git, a merge must occur within a single repository i.e. all the branches to be merged must be present in the same repository
git checkout branch
git merge other_branch
git commit -a -m "commit message"
1. Register at www.github.com 2. Create a new public repository at www.github.com 3. Download and Install msysgit from [here](https://code.google.com/p/msysgit/downloads/list "Download msysgit") 4. Create a folder for your new local repository 5. Open Command-Prompt or Powershell 6. Run command ` git --version ` 7. Run command to initialize a new local git repository ` git init ` 8. Now go back to www.github.com and copy the remote repository HTTPS link onto your clipboard 9. Run command to add the remote repository as an origin ` git remote add origin remoterepoURL ` 10. Run command to cross check the origin ` git remote -v ` 11. Create a new file readme.txt 12. Run command to check the status of the index ` git status ` > tracked > untracked > ignored 13. Run command to add new file for staging ` git add readme.txt ` and check status ` git status ` 14. Run command to unstage the file ` git rm --cached readme.txt ` 15. Run command to commit the changes ` git commit -m "commit message" ` 16. Run command to push the changes to remote repository ` git push origin master ` 17. Create a new file gitignore.txt file in your local repository 18. Run command to rename gitignore.txt to .gitignore ` ren gitignore.txt .gitignore ` 19. Run command to add all the file for staging ` git add --all ` 20. Run command to reset on step back ` git reset HEAD ` 21. Run command to create and checkout a branch ` git checkout -b develop ` 22. Run command to push changes to new branch ` git push origin develop ` 23. Run command to switch back to master branch ` git checkout master ` 24. Run command to merge the develop into the master branch ` git merge develop ` 25. Run command to publish local commits after merging ` git push origin master ` Thank you
With Regards
Abhishek Luv
Happy Learning
What is source control? Basics of Git and GitHub. are you new to source control?
Today's show is on Source control and the basics of git & GitHub.
Revision control, source control or source code management plays a very important role in today's software development process.
Students and developers should use source control for their projects because it allows distributed work in teams of any size, at different locations while avoiding any source code changes.
Let's talk about source control in simple words “source control also knows as version control and source code management is the management of multiple revisions of the same unit of information.
Next let's talk about the basic concepts of git
Git: Basic Conceptswhat is a repository
A repository is simply a database containing all the information needed to retain and manage the revisions and history of a project. Within a repository, Git maintains two primary data structures, the object store and the index.
The object store is designed to be efficiently copied during a clone operation as part of the mechanism that supports a fully DVCS.
Index is transitory information, is private to a repository and can be created or modified on demand as needed.
Git Object Store
It contains your original data files and all the log messages, author information, dates, and other information required to rebuild any revision or branch of the project.
There are four types of Object stores
Index
the index is a temporary and dynamic binary file that describes the directory structure of the entire repository.
Index captures a version of the project's overall structure at some moment in time. As the developer, we execute Git commands to stage changes in the index. Changes usually add, delete or edit some files or set of files. The index records and retains those changes, keeping them safe until you are ready to commit them. You can also remove or replace changes in the index.
Content-Addressable Names
the Git object store is organized and implemented as a content-addressable storage system. Each object in the object store has a unique name produced by applying SHA1 to the contents of the object, yielding an SHA1 hash value. Any tiny change to a file causes the SHA1 hash to change, causing the new version of the file to be indexed separately.
SHA1 values are 160-bit value that are usually represented as a 40 digit hexadecimal number.
For example 937082042f48a5cbc7777634509310fff059bc19
File Management and The IndexIndex
Git's Index doesn't contain any file content: it simply tracks what you want to commit when you run git commit. Git checks the index rather than your working directory to discover what to commit.
You can query the state of the index at any time with the command git status
File Classification in Git
Git Commands.gitignore file ### (I forget to discuss command in the podcast but its discussed in the course)
add any file name in the .gitignore file which you want to ignore
Git Command Line Commands
add, branch, checkout,clone,commit,diff,init,log,merge,mv,pull,push,rebase,reset,rm,show,status
Git Version Check
git --version
Creating an initial repository
git init
Adding file to your repository
git add index.html
Git status
git status
Configuring the commit author
git config user.name "abhishekluv"
git config user.email "abhishekluv@gmail.com"
Git Commit
git commit -m "commit message"
git commit --message="commit message"
Viewing your commits
git log
Show branch
git show-branch --more=10
Removing a file in your repository
git rm index.html
Global commit author details
git config --global user.name "abhishekluv"
git config --global user.email "abhishekluv@gmail.com"
Branches
A branch is the fundamental means of launching a separate line of development within a software project.
Git allows many branches and thus many different lines of development within a repository.
Creating a branch
git branch branchname
list branches
git branch
list of branches with details
git show-branch
changing/checking out branches
git checkout branchname
creating and checking out a new branch
git checkout -b branchname
deleting a branch
git branch -d branchname
Merges
what is git merge
In Git, a merge must occur within a single repository i.e. all the branches to be merged must be present in the same repository
git checkout branch
git merge other_branch
git commit -a -m "commit message"
Welcome to this course on "Learn The Basic's of Git & GitHub In Hindi".
Brought to you by : Develop2Deploy
Note : Course is in Hindi Language and Not English.
What is the course about?
What things you'll be learning in this course?
Who should take this course?