Saturday, May 16, 2015

Git for beginers

In this tutorial, I will explain how to use Git for your projects and how to commit the changes,create the pull request and merge the pull request.

Commit the changes and create  the pull request
  • Clone the repository from git
git clone https://github.com/xxx/xxx.git
  • Check the changes after implementation
git diff
  • Add the file to staging
git add <filename>
  • Add more files to staging
git add *
  • Check the status of the file
git status
  • Commit the changes to local
git commit -m "Commit message"
  • Check the commit log
git log
  • Send changes to the master branch of your remote repository:
git push origin master
  • In left of the "Branch" menu, click the green Compare and Review button.
then click “Create pull request” and type a title and description for your pull request after that click “Create pull request”
the pull request looks like - https://github.com/xxx/xxxx/pull/123

Get the pull request and merge in master.
  • Fetch the pull request
git fetch origin pull/150/head:150
  • Merge the pull request with master
git merge 150
More useful commands
  • Remove the all changes in modified files
git checkout .
  • Remove the changes in particular file
git checkout ./fileName
git reset
  • Remove all untracked files
    git clean -f -d
  • Revert the commit
    git log
    git revert commit-id








No comments:

Post a Comment

Create a REST API with Spring Boot

In this post, I will explain how to create a simple a REST API with Spring Boot Spring Boot Spring Boot is a framework that provides inbuil...