Skip to content

Git

Git Cheat Sheet

Contributing to an Open Source Project

Follow these steps to contribute to an open source repository on GitHub:

  1. Fork the repository

    • Navigate to the repository on GitHub.
    • Click on the Fork button in the top-right corner. This creates a copy under your account.
  2. Clone your fork locally

    git clone https://github.com/your-username/repository-name.git

    Replace your-username and repository-name with your GitHub username and the project name.

  3. Create a new branch for your changes

    git checkout -b feature/my-feature
  4. Make changes and stage them

    git add .
  5. Commit your changes

    git commit -m "Explain your feature or fix"
  6. Push your branch to your fork

    git push origin feature/my-feature
  7. Create a Pull Request (PR)

    • On GitHub, navigate to your fork.
    • Click Compare & pull request.
    • Provide a clear title and description, then submit the PR.

Pushing Without Triggering CI/CD Actions (Windows / Linux)

Use special keywords in your commit message to prevent automated pipelines (like GitHub Actions) from running for that specific push:

Prepare all modified files to be committed:

git add .

Create the commit, adding a specific keyword phrase to the commit message. Common keywords include [skip ci], [ci skip], [no ci], [skip actions], or [actions skip]:

git commit -m "Your commit message [skip ci]"

Upload your commit(s) to the main branch on the remote named origin:

git push origin main

act - Run your GitHub Actions locally (Windows)

Use act to run your GitHub Actions locally for fast feedback without pushing changes.

  1. Download the binary Download the latest release binary for Windows from the nektos/act releases page.

  2. Install Docker Install Docker Desktop for Windows. act uses Docker containers to simulate the GitHub Actions environment.

  3. Setup the executable

    • Save the binary in a dedicated directory, for example: C:\Users\<your-username>\.act.
    • Add this directory path to your Windows Environment Variables under Path.
  4. Run the tool Open PowerShell, navigate to your git repository’s root directory, and execute the command:

    act
  5. If your workflow relies on secrets or environment variables, you can pass them to act using flags or files:

    • Run with a secrets file
      Create a file (e.g., .secrets) containing your keys in KEY=VALUE format, then run:
      act --secret-file .secrets
    • Run with manual secrets
      Inject a specific secret directly in the command line:
      act -s MY_SECRET=somevalue
    • Run with environment variables
      act automatically looks for a .env file in the current directory. To specify a custom file:
      act --env-file .env
Last updated on