TestingDocs.com
    Software Testing website
    • Automation
      • Selenium
      • JBehave Framework
    • Tutorials
      • MySQL Tutorials
      • Testlink
      • Maven
      • Git
    • IDEs
      • IntelliJ IDEA
      • Eclipse
    • Flowcharts
      • Flowgorithm
      • Raptor
    • About

    Git

    Practical Git Commands

    Introduction

    In this post, we will discuss some practical Git Commands. These are frequently used commands while working with automation using Git. Git is a distributed version source control system.

    init

    To initialize a Git repository, type the following command:

    /> git init

    status

    /> git status

    To know the project status. It’s healthy to run git status often. Sometimes things change and you don’t notice it.

    Adding Changes

    When we add a new file, we will notice that Git says it is “untracked”. Git sees that as a new file. To tell Git to start tracking changes made to sample.txt, we need to first add it to the staging area by using git add.

    /> git add sample.txt

    staged:
    Files are ready to be committed.

    unstaged:
    Files with changes that have not been prepared to be committed.

    untracked:
    Files aren’t tracked by Git yet. This usually indicates a newly created file.

    To tell Git to start tracking changes made to a file , we first need to add it to the staging area by using git add.

    git add sampleFile.txt

    git reset

    You can use git reset <filename> to remove a file or files from the staging area.

    git log

    Use git log –summary to see more information for each commit. You can see where new files were added for the first time or where files were deleted. It’s a good overview of commits.

    git push

    The push command tells Git where to put our commits when we’re ready. The -u tells Git to remember the parameters( like remote and local branch names ) , so that next time we can simply run git push and Git will know what to do.

    git stash

    Sometimes when you go to pull you may have changes you don’t want to commit just yet. One option you have, other than committing, is to stash the changes. Use the command ‘git stash’ to stash your changes, and ‘git stash apply’ to re-apply your changes after your pull.

     

    Git Tutorial on this website can be found at:

    https://www.testingdocs.com/git-tutorials/

    For more details on the Git, visit the official website at:

    https://git-scm.com

    Related Posts

    branching

    Git /

    What is Branching?

    Git Install on Linux

    Git /

    Install Git on Ubuntu Linux

    Version_Control_Centralized

    Git /

    Overview of Version Control Systems

    Git Website

    Git /

    Getting Started with Git Version Control

    Install Git on Windows 10

    Git /

    Install Git on Windows 10

    ‹ Concurrent Versions System( CVS)› Git Version Control Introduction for Testers

    Recent Posts

    • Running Tests in Parallel with Selenium Grid
    • Advanced Selenium Features
    • Locating Web Elements
    • Running the Test Script
    • Writing Your First Selenium Test Script
    • Getting Started with Selenium Automation Testing
    • Setting Up the Environment
    • How can you monitor the Quality Assurance Audit?
    • Leveraging LambdaTest with Appium 2.0
    • Appium 2.0 Plugins ListAppium 2.0 Plugins
    • Touch Actions and Multi-Touch Actions
    • Changes in Drivers and Classes
    • Appium Inspector
    • Capabilities in Appium 2.0
    • Appium 2.0 Driver ListAppium 2.0 Driver Installation & Management
    CyberLink Multimedia Software

    Back to Top

    Links

    • Contact
    • Privacy Policy
    • Cookie Policy

    www.TestingDocs.com