0% found this document useful (0 votes)
5 views

Git Basic Commands

Uploaded by

J.K. Technology
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Git Basic Commands

Uploaded by

J.K. Technology
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Git Basic Commands

Git and GitHub:


Introduction to Version Control,
Git Basics and Commands,
Branching and Merging Strategies,
Collaboration using Git and GitHub
explain Step by step...

Certainly! Let's break down the process step by step:


Introduction to Version Control:
1. Understanding Version Control: Start by understanding what version control is and
why it's important. Version control allows you to manage changes to your code or
any set of files over time.
2. Types of Version Control Systems: Introduce the concept of centralized and
distributed version control systems. Git falls under the category of distributed version
control systems.
Git Basics and Commands:
1. Installing Git: Begin by installing Git on your system. You can download it from the
official Git website and follow the installation instructions provided.
2. Configuring Git: After installation, configure Git with your name and email address.
This information will be associated with your commits.
3. Initializing a Repository: Create a new Git repository for your project using the git
init command. This initializes a new repository in the current directory.
4. Adding and Committing Changes: Use the git add command to stage changes and
the git commit command to save those changes to the repository.
5. Viewing Repository Status: Use git status to see the current status of your
repository, including any changes that have been made but not yet committed.
6. Viewing Commit History: Use git log to view a history of commits in the repository,
including information about who made each commit and when.
Branching and Merging Strategies:
1. Understanding Branches: Explain the concept of branches in Git. Branches allow you
to work on different features or fixes independently of each other.
2. Creating a Branch: Use the git branch command to create a new branch. For
example, git branch new-feature.
3. Switching Branches: Use the git checkout command to switch between branches.
For example, git checkout new-feature.
4. Merging Branches: Once work on a branch is complete, merge it back into the main
branch (usually master or main) using the git merge command.
5. Resolving Conflicts: In case of conflicts during merging, resolve them manually by
editing the conflicted files, then commit the changes.
Collaboration using Git and GitHub:
1. Setting up a Remote Repository on GitHub: Create a new repository on GitHub and
link it to your local Git repository using the git remote add command.
2. Pushing Changes to GitHub: Use the git push command to push your committed
changes to the remote repository on GitHub.
3. Pulling Changes from GitHub: Use the git pull command to fetch and merge changes
from the remote repository to your local repository.
4. Collaborating with Others: Invite collaborators to your GitHub repository, allowing
them to push and pull changes just like you.
5. Handling Pull Requests: When collaborators make changes and want to merge them
into the main branch, they can open a pull request on GitHub. Review the changes
and merge them if they're satisfactory.
By following these steps, you can get started with version control using Git and GitHub,
manage your projects effectively, and collaborate with others seamlessly.
public class GoogleSearchTest {

@Test
public void testGoogleSearch() {
// Set the path to the ChromeDriver executable
System.setProperty("webdriver.chrome.driver", "path/to/chromedriver");

// Initialize the ChromeDriver


WebDriver driver = new ChromeDriver();

// Open Google
driver.get("https://www.google.com");

// Perform a search
driver.findElement(By.name("q")).sendKeys("Selenium WebDriver");
driver.findElement(By.name("q")).submit();

// Verify the page title


Assert.assertTrue(driver.getTitle().contains("Selenium WebDriver"));

// Close the browser


driver.quit();
}
}
package selenium ;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class testing2 {

public static void main(String[] args) throws InterruptedException {


WebDriver driver;

// TODO Auto-generated method stub


System.setProperty("webdriver.chrome.driver", "C:\\Users\\khdta\\
Desktop\\SEM 6\\DevOps\\chromedriver-win64\\chromedriver.exe");

driver = new ChromeDriver();

// Test Case - 1 Home page

driver.get("http://127.0.0.1:5500/index.html");

WebElement login =
driver.findElement(By.xpath("/html/body/div/section/div[2]/div/div[1]/div/div/div[1]/div/
div/a[1]"));
login.click();
WebElement signup =
driver.findElement(By.xpath("/html/body/div/section/div[2]/div/div[1]/div/div/div[1]/div/
div/a[2]"));
signup.click();

WebElement title =
driver.findElement(By.xpath("/html/body/div/header/div/nav/a/span"));
String value = title.getText();
System.out.print(value);
String value2 = "User Management and Administration";
if(value.equals(value2)) {
System.out.print(" Equal");
}
else {
System.out.print(" not equal");
}

// Test Case - 2 Login Page

WebElement login_new =
driver.findElement(By.xpath("/html/body/div/section/div[2]/div/div[1]/div/div/div[1]/div/
div/a[1]"));
login_new.click();

WebElement user =
driver.findElement(By.xpath("/html/body/section/div/div/div/div/div/div/form/div[1]/
input"));
user.sendKeys("Taher");

WebElement pass =
driver.findElement(By.xpath("/html/body/section/div/div/div/div/div/div/form/div[2]/
input"));
pass.sendKeys("admin");

WebElement login_validate =
driver.findElement(By.xpath("/html/body/section/div/div/div/div/div/div/form/div[3]/
button"));
login_validate.click();

// Test Case - 3 SignUp Page

WebElement signup_new =
driver.findElement(By.xpath("/html/body/div/section/div[2]/div/div[1]/div/div/div[1]/div/
div/a[2]"));
signup_new.click();

You might also like