CompleteGt GitHubTutorials
CompleteGt GitHubTutorials
We have a project folder , now we have to maintain the history(new files created, changes made on
files and so on) of the files under this project folder how to do this
All of these history are stored in a folder that git provides us , it is called .git(hidden) folder
the .git folder is created by executing the command "git init" (intialize empty git repository)
contents of the .git folder are HEAD description info refs config hooks objects
How to check for committed and uncommitted files and which is the current branch in git ---> use the
command git status
uncommitted files are untracked files(not added to history or staging area) .. to add them to git
repository and track them git add . (. means all the files in the directory)
Red files are untracked files and Green files are tracked files (added to history or staging area)
to track a file( put into git history) you will have to commit it using the git commit
TO remove files which have already been committed from stage(staging area) use the command git
restore --staged filename
git reset hashcode command is used to take you to some commit point (status at some point of
time)
git stash and git stash pop and git stash clear
two tasks : HOSTING YOUR PROJECT FOR FIRST TIME ON GITHUB FOR OTHERS TO USE
WE WANT A GITHUB URL (NEW REPOSITORY CREATED) TO BE ATTACHED TO OUR PROJECT(LOCAL
SOURCE CODE DIRECTORY) THE COMMAND USED IS
origin means name of the url you are going to add(nick name of the url is called origin)
git remote -v will list all the url's attached to the project folder
git push (to which url you want to push) ( and to which branch you want to push)
You should never commit on the main branch(ideally). In practice a new branch is branched out from
the main branch and developers start committing on that branch
=============================
git checkout feature ( now HEAD which was earlier pointing to the main or master branch will point
to the feature branch)
head is just a pointer, all new commits you make will be added on the head, hence all the new
commits i am making will be added on the feature branch)
CHECKOUT COMMAND MEANS HEAD WILL POINT TO THAT BRANCH say
“Kunal” . All the commits now made will be made to “kunal” branch
Checkout is like steering of the car , where you change the steering you
change the direction, then you will apply breaks and do the commit in that
path of the road