Skip to main content

git


Image result for git logo

git is a useful platform for software project management where it gives you speed and efficiency when handling larger or smaller projects.
git keeps track of your workflow and editing ,branching , merging and debugging the code is granted to different users.


  • git config
    • git config –global user.name “[name]”
    • git config –global user.email “[email address]”
  • git init 
    • initiates git
  • git clone
    • clones git project to the current directory
  • git add
    • adding files to the staging area.
  • git commit
    • git commit -m “[ Type in the commit message]”
    • records the files in the staging area permanently in the history
  • git diff
    • shows the files differences which are not yet staged
  • git diff –staged
    • This command shows the differences between the files in the staging area and the latest version present.
    • git diff [first branch] [second branch]
  • git commit -a
    • This command commits any files you’ve added with the git add command and also commits any files you’ve changed since then.
  • git reset
    • un-stages the file , but preserves the file contents.
    • git reset [commit] -undoes all the commits after the specified commit and preserves changes locally.
  • git status
    • lists the files that have to be commited
  • git rm [file]
    • removes files from the staging area.
  • git log
    • lists the version history of the current branch.
    • git log –follow[file] - version history for a selected file.
  • git show
    • shows the metadata and content changes of a specified commit.
  • git tag
  • git branch
    • git branch [branch name] - creates a new branch.
  • git checkout
    • switch from one branch to the other.
  • git merge
    • merges the specified branch name to the current branch.
  • git remote
    • git remote add [variable name] [Remote Server Link]  
      This command is used to connect your local repository to the remote server.
  • git push
  • git pull
  • git stash
The working flow of a git project is shown below.
Image result for what is git
pull, fetch , commit add in the local repository

Image result for what is git
branching , merging and committing.


How to change a recent commit message 

Commit which is not pushed to the remote branch


  1. git commit --amend
  2. Change the commit message in the text editor 
  3. save the changes in the text editor

Commit which is pushed to the remote branch

  1. Follow the 3 steps as mentioned above
  2. git push --force <branch name>
    1. eg: git push --force origin feature/roi-orderahead-calculator.







Comments

Popular posts from this blog

Releases of a project

On 16th Friday the task was to release the changes made to the maven project we were working on so that the Delivery Assurance (DA) team can test it. The steps taken for the project release. Check the project for one last time for cleaning up. Check whether the colleagues changes are also present in the development branch.  After checking confirm the changes are committed to the development branch . Checkout to a new branch tag. eg:                    git checkout -b S12-t realease                   git push --set-upstream origin S12-release                     If all are set we are ready to release. Enter the following command mvn release:prepare -Darguments="-DskipTests" - Dresume=false; -Dresume=false : this means the committed changes will not be pushed if any network error occurs while releasing. Th...

10-09-2019_Week3-Wednesday

Creating a WebAPP of Movies to show Actors and movies Home Page Tabs Movies Actors. Buttons Add movie > movie submit Form Add actor > Actor submit Form Databases/Submit Forms Movies Name Year Genere Actors Description Image Actors Name fname last name  Date of birth  Description