How To "Revert-Back" To "Previous-Version"???: Build 1 Testing Deployment
How To "Revert-Back" To "Previous-Version"???: Build 1 Testing Deployment
c
h U
a n
n |
g d
e o
File6
File1 File2 File3
File5 File5
File4
Tracking an existing project using GIT
• In order to track files of an existing project we
need to initialize a GIT repository inside the
project.
• For this go to the project directory using GIT Bash
and run following command:
<directory path> git init
• If the above command is successful, then a empty
GIT repository is created inside the specified path.
(as a hidden holder)
• This empty GIT repository is just a GIT skeleton and
none of the files are tracked yet.
• But how to track files of any project????
Adding files to “GIT repository”
• For tracking any files we need to add them in GIT
repository and then do a initial “commit”. This is
done by following commands :git add *.txt
The above command will add all files having .txt
extension
In order to check the status of files, we can use
following command: git status
> In order to commit already track files following
command is used : git commit –m “my first commit”
The above command will do a “commit” and needs a
commit statement.
Without commit statement the process will be
aborted.
GIT file status life cycle
Git local
repository
Working
directory
Commit
Staging Area
Add
Changing already tracked files -
Modification
• In order to see any new change in the files which are
already tracked following command is used :
git status
• Lets do a small change in our project :
We need to double the quantity of tea.
For this all files under “Ingredients” and
“IngredientCost” will be change.
• Now again run the following command to see the
new status of the files :
git status
It will show all the files which are changed.
Adding Modified files - Staging
• Every time we change/modify already tracked
file we need to “add” it again so that it will
ready to “commit”.
• This process is known as “Staging”.
• For staging modified files we have to use “add”
command again :
git add *.txt
> “add” is a multipurpose command which is used
to make your files ready for commit.
GIT file status life cycle cont.
• There are three important states of GIT files :
1. First one is the working directory where a
programmer do all of his work.
2. Once we use “add” command on working
directory all files are “staged” or ready to
commit. Here the snapshots of all files are
already taken.
3. When we use the “commit” command, only
those snapshots are permanently stored in the
GIT repository which have some “changes”.
Command To display changes
• In order to display all “changes” done in the
files following command is used:
“git diff”