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

Hackerank Q&A

HACKERANK SQL PROBLEMS. Question: Generate the following two result sets: Query an  alphabetically ordered  list of all names in  OCCUPATIONS , immediately followed by the first letter of each profession as a parenthetical (i.e.: enclosed in parentheses). For example:  AnActorName(A) ,  ADoctorName(D) ,  AProfessorName(P) , and  ASingerName(S) . Query the number of ocurrences of each occupation in  OCCUPATIONS . Sort the occurrences in  ascending order , and output them in the following format: There are a total of [occupation_count] [occupation]s. where  [occupation_count]  is the number of occurrences of an occupation in  OCCUPATIONS  and  [occupation]  is the  lowercase  occupation name. If more than one  Occupation  has the same  [occupation_count] , they should be ordered alphabetically Answer:   select ( case when occupation= "Doctor" then concat( name ...

Research Project: AutoComplete Business Places Search Form

RESEARCH PROJECT  AUTOCOMPLETE BUSINESS PLACES SUGGESTING DROP DOWN LIST Date: 09/08/2019 The research is on how to use google powered auto suggest input form to search businesses and show its address too. And a thread has been found on auto completing drop down list on google maps platform. A look alike project on autocomplete for addresses and search terms is there in google Maps Platform for developers. The Steps taken. First of all you need the example code in your PC. Create a test Project in google Console. Autofill-inputbox Then the relevant API enabled in That project console. In this case the "Places API" An API key for a particular project. Tried running with the acquired API in the code and putting the file on tomcat server as a jsp file. Still the billing_error comes. The problem was maps API was not enabled. So that the page didn't load. But when it's enabled the website worked for a several seconds. Returning the ...

Check Form Validity

Applova Home page Form Validation. This weeks task was to validate the data that is entered to the Autocomplete business Search Form I created previously. And the second form needed the same modifications. The user was to be restricted from submitting the following: Spaces  Words less than 2 characters Invalid emails The submit button has to be disabled if the three fields were not filled. Using minimal changes in the code this had to be done. And new libraries cannot be used. In that case jquery validation plugin was not an option. But it was the easiest one we had in mind. A small coding for form validation and the plugin script was to be added to solve this matter. But without using that plugin the form was validated and compromised of the invalid inputs as shown below. function getDemoHomeSectionClick () { var user_input = document. forms [ 'form' ][ 'SingleLine1' ]. value ; if ((user_input. trim ()). length < 2 ) { ...