0% found this document useful (0 votes)
10 views2 pages

Git Part 1

The document provides an overview of Version Control Systems (VCS), specifically focusing on Git, which can be centralized or distributed. It outlines the prerequisites for using Git, including setting up a working directory, initializing a local repository, and various Git commands for managing files, commits, and branches. Additionally, it explains how to configure user settings, check commit logs, and merge branches within Git.

Uploaded by

lafawa3307
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Git Part 1

The document provides an overview of Version Control Systems (VCS), specifically focusing on Git, which can be centralized or distributed. It outlines the prerequisites for using Git, including setting up a working directory, initializing a local repository, and various Git commands for managing files, commits, and branches. Additionally, it explains how to configure user settings, check commit logs, and merge branches within Git.

Uploaded by

lafawa3307
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

GIT PART --1

-------------------

VCS --> VERSION CONTROL SYSTEM

TWO TYPES:

CENTRALISED VERSION CONTROL SYSTEM --> ( CVCS )


DISTRIBUTED VERSION CONTROL SYSTEM --> ( DVCS )

PRE REQUISITES BASED ON DVCS


--------------------------------------------------

WORKING DIRECTORY

DEVLOPER WILL DO THE WORK IN WORKING DIRECTORY WITH THE RESPECTIVE LANGUAGE CALLED
AS (WORKING COPY)

SINCE WE ARE USING DVCS WE HAVE TO USE ---> git init [ FOR THE CREATION OF LOCAL
REPO (LR) ]

STEPS:
1. LAUNCH AMAZON LINUX INSTANCE AND INSTALL GIT CLIENT USING --> (yum install git -
y)
2. CHECK FOR THE VERSION AND COMPARE WITH THE STABLE VERSION OF GIT
3. HAVE TO CREATE A WORK STATION OR WORKING DIRECTORY TO DO THE WORK.
4. CREATE A FILE AND PUT ANY INPUT AND SAVE IT. THEN CHECK FOR THE GIT STATUS USING
( git status )
5. FOR CREATING LOCAL REPO USE ( git init ) INSIDE THE WORKING STATION.
6. THEN LIST WITH ( ls -lart )
7. NOW CHECK GIT STATUS ( git status -s ) [ s --> shortcut ] & AGAIN CHECK WITH
( git status )

[STAGING AREA --> IT IS A AREA WHICH CAN BE CALLED AS CACHE AREA OR TEMPORARY AREA.
UNTRACKED FILES OR
UNCOMMITED FILES ARE STORED HERE.]

WHAT IS GIT STASH?

8. TO ADD UR FILE TO STAGING AREA USE ( git add <filename> )

[NOTE: TO UNSTAGE A FILE FROM STAGING AREA WE CAN USE ( git rm --cached
<filename> )].

[NOTE : USER CONFIGURATION CAN BE DECLARED GLOBALLY AND AS WELL AS SPECIFIC WORKING
DIRECTORY]
TO CHECK WHETHE ANY USER CONFIGURATION DONE USE (git config -l)

9. BEFORE EXECUTING A COMMIT WE HAVE TO GIVE THE CREDENTIALS THAT WHICH PERSON HAS
COMMITED THE CODE
FOR THAT CASE USE (git config --global user.name "goutham") & (git config --global
user.email "[email protected]")

10. NOW WE NEED TO COMMIT THE CODE USING (git commit -m "First commit") [-m -->
message]
11. TO CHECK THE COMMIT LOG USE (git log)

[TASK : YOU HAVE DONE A MISTAKE IN COMMIT CAN WE REWRITE THE MESSAGE OR COMMIT]
[NOTE: IF WE HAVE DONE ANY CHANGE IN THE FILE WE ARE CURRENTLY USING THEN IF WE
WANT TO ADD STAGING AREA ( git add <file>)
OR IF WE DONT NEED TO REFLECT THE CHANGES IN THE WORKING FILE ( git restore
<filename> )].

12. TO CHECK THE COMMIT LOGS IN A SINLE LINE USE ( git log --oneline)
13. CREATE A REPOSITORY IN GITHUB WHERE DO U WANT TO PUSH CODE.
14. IF WE WANT TO PASS A VARIABLE FOR THE URL WE GET REPOSITORY USE ( git remote
add <variable name> <url of repo>).
15. TO CHECK BRANCH USE (git branch).
16. TO PUSH THE CODE FROM LR TO REMOTE REPO USE ( git push -u <variable name>
<branch name>).
17. TO CHECK WHICH BRANCH I AM IN USE ( git branch )
18. TO CREATE A NEW BRANCH USE ( git branch <branchname>)
19. TO MOVE FROM BRANCH TO ANOTHER BRANCH USE ( git checkout <branchname>)

[NOTE: COPY OF UR MASTER BRANCH IS CALLED AS FEATURE BRANCH]

20. THEN DO SOME CHANGES IN THE FILE WE ARE WORKING AND CHECK THE GIT STATUS AND DO
THE FOLLOWING (git commit -am "commit name")
21. THEN CHECKOUT TO MASTER BRANCH AND CHECK LOG.

[IF WE WANT INCLUDE THE COMMIT DONE IN FEATURE BRANCH WE CAN GO WITH GIT MERGE
( git merge <branchname>) ]

You might also like