git labs basic commands

  1. login to ubuntu system as root user:
sudo su - 
//It will prompt for password, provide the same password of ubuntu server

2.  check the git version

git –version

3. set the global parameter

1. git config --global "<your-firstname> <your-lastname>"
2. git config --global "<your-email@address>"
 git config --global "amit"
git config --global ""
git config --global --list 
export EDITOR=vi

Create and initialize a local Git repo

#Change to your home directory
cd ~
 #Create a new directory, which we will initialize as git-enabled
mkdir my-repo
 #Change into the new directory
cd my-repo
#Check the current git status of the new directory
git status
#Initialize the directory as a git-enabled
git init
ls -al
git status

git commands

#Change the directory to my-repo and Add a file using touch command

touch Readme
# check the git status
git status
#Under ‘Untracked files’ you should see “Readme”, showing that this file has been changed but has not yet been added
# Add the README file to the Git staging area 
git add Readme
git status
#commit the file, -m option to add message while committing
git commit -m "Adding file"
git status
#Run git log, to see the commit history
git log