Here is a step-by-step example of using GitHub to track changes to a simple project:
Sign up for a GitHub account: Go to https://github.com and sign up for a free account.
Install Git: Download and install Git from https://git-scm.com/.
Create a repository: Go to the GitHub homepage and click the "New repository" button. Give your repository a name (e.g. "my-first-project") and choose a public or private visibility setting.
Clone the repository: Open a terminal window and navigate to the directory where you want to store your project files. Run the following command to clone the repository to your local machine:
git clone https://github.com/[your-username]/my-first-project.git
git clone https://github.com/bestdivision/my-first-project.git
- Make changes: Open the project directory in your text editor and make some changes to the code. For example, you might add a new file called "index.html" with the following content:
<html> <head> <title>My First Project</title> </head> <body> <h1>Hello, World!</h1> </body> </html>
- Commit changes: Navigate back to the terminal and run the following commands to stage and commit your changes:
$ git add index.html $ git commit -m "Added index.html file"
- Push changes: Run the following command to push your changes to the remote repository on GitHub:
$ git push origin master
- Check the repository: Go back to the GitHub website and refresh the repository page. You should see your changes reflected in the file list and commit history.
These are the basic steps to use GitHub to track changes to a simple project. Of course, this is just the tip of the iceberg – there are many more features and tools available, such as pull requests, branching, and merging, that you can use to collaborate with other developers and manage more complex projects.