Welcome to the IEEE: Computer Society!
This is your first-ever GitHub repository! Ever heard of hazing? Well, this is it... but way more fun. By the end of this workshop, you'll have successfully created your first commit on GitHub. Let's get started!
Before you begin, you need to install Git and the GitHub CLI. Follow the instructions below based on your operating system.
- Open Terminal.
- Run the following command to check if Git is already installed:
git --version
- If Git is not installed, install it via Homebrew:
brew install git
- Verify the installation:
git --version
- Install GitHub CLI using Homebrew:
brew install gh
- Verify the installation:
gh --version
- Download the Git installer from here.
- Run the installer and follow the default setup.
- Open Command Prompt or PowerShell, and verify the installation:
git --version
- Download the GitHub CLI installer from here.
- Install it and restart your terminal.
- Verify the installation:
gh --version
- Open a terminal and install Git based on your distribution:
sudo apt install git # Debian/Ubuntu sudo dnf install git # Fedora sudo pacman -S git # Arch
- Verify the installation:
git --version
- Follow the installation guide for your distro from GitHub CLI.
- Verify the installation:
gh --version
Open your terminal and navigate to the directory where you want to clone the repository. Then, run:
git clone https://github.com/Computer-Society-WSU/Hello-World.gitThis will create a local copy of the project on your machine.
Navigate into the cloned repository:
cd Hello-WorldThen, create a new branch:
git checkout -b your-new-branch-nameReplace your-new-branch-name with a relevant name for your contribution.
Create a new file in your preferred programming language that prints "Hello, World". Example for Python:
print("Hello, World")Save this file inside the Hello-World directory.
Add your changes:
git add .Commit your changes with a meaningful message:
git commit -m "Added my Hello, World program"Push your changes to GitHub:
git push origin your-new-branch-nameReplace your-new-branch-name with the name of the branch you created earlier.
- Go to the GitHub repository.
- Switch to your branch.
- Click on "Pull Request" and fill in the details.
- Submit your pull request!
Congratulations! 🎉 You've made your first contribution to a GitHub project!
After your pull request has been reviewed and approved, you can merge your changes into the main branch. Follow these steps:
- Switch to the main branch:
git checkout main
- Pull the latest updates from the main branch:
git pull origin main
- Merge your branch into the main branch:
git merge your-new-branch-name
- Push your changes to the main branch:
git push origin main
To switch to another branch, use:
git checkout another-branch-nameReplace another-branch-name with the branch you want to switch to.
Explore advanced Git features such as:
- Rebasing: Integrate changes from another branch cleanly.
- Cherry-picking: Apply specific commits from one branch to another.
- Handling merge conflicts: Resolve conflicts when merging branches.
Check the Git documentation or other online resources to deepen your understanding.
If you get stuck, don't hesitate to ask for help.
Bonus AI-generated joke:
Why don’t programmers like nature? It has too many bugs! 🐛