/new-project

Public repo for GlobalLogic infrastructure

new-project

Public repo for software development infrastructure based on git, K3s, Docker


A basic guide on how developers can use Git:

Git Basics:

  1. Install Git:

    • Download and install Git from the official website: Git Downloads.
  2. Configure Git:

    • Set your username and email address using the following commands:
      git config --global user.name "Your Name"
      git config --global user.email "your.email@example.com"
      
  3. Create a New Repository:

    • To start a new project or add version control to an existing project, navigate to the project's directory and run:
      git init
      

Working with Repositories:

  1. Clone a Repository:

    • To get a copy of an existing repository, use:
      git clone <repository-url>
      
  2. Check Repository Status:

    • View the status of changes in your working directory with:
      git status
      

Making Changes:

  1. Stage Changes:

    • Add changes to the staging area before committing:
      git add <file1> <file2> ...
      
  2. Commit Changes:

    • Save staged changes to the repository:
      git commit -m "Your commit message"
      

Branching:

  1. Create a Branch:

    • Start a new branch for a feature or bug fix:
      git branch <branch-name>
      
  2. Switch Branches:

    • Move to a different branch:
      git checkout <branch-name>
      

Merging:

  1. Merge Changes:
    • Combine changes from one branch into another:
      git merge <branch-name>
      

Remote Repositories:

  1. Add a Remote:

    • Connect your local repository to a remote repository:
      git remote add origin <remote-url>
      
  2. Push Changes:

    • Upload local changes to a remote repository:
      git push -u origin <branch-name>
      
  3. Pull Changes:

    • Update your local repository with changes from the remote repository:
      git pull origin <branch-name>
      

Handling Conflicts:

  1. Resolve Conflicts:
    • If conflicts arise during a merge, resolve them manually and then:
      git add <conflicted-file>
      git commit
      

History and Logs:

  1. View Commit History:

    • See a log of all commits:
      git log
      
  2. Differences:

    • View changes between commits, branches, etc.:
      git diff <source-branch> <target-branch>
      

This is a basic guide, and Git is a powerful tool with many features. Developers may need to refer to the official Git documentation for more advanced usage and troubleshooting: Git Documentation.