[This repository is for students of the CODE University Technical Documentation course to get up to ensure each student knows how to push files to a common repository.]
- Initialize a local directory
- Clone the remote repository
- Make a new branch
- Add a new markdown (.md) file to your local Repo
- Merge your branch to main
- Commit your changes
- Push your changes to the remote repository CODE-class
1. Initialize a local directory
Make a directory and name it CODE-class then cd into it. Afterwards, run the following command:
git initThe local repo is ready now for cloning a remote Repository into it.
2. Clone the remote repository
Clone the CODE-Class repository into the local REPO directory you just created:
git clone https://github.com/glennlea1525/CODE-class.git4. Make a new branch
git checkout -b <my-branch> (make new branch)3. Add a new markdown (.md) file to your local Repo
Make a new file and name it as follows:
<your_name.md>
In this file, use Markdown to add your name. You can add anything else you want here, as long as it is in Markdown.
{
"firstName": "Glenn",
"lastName": "Lea",
}
Save the file
Note: git branch shows the new branch only after first commit.
4. Track your changes
Shows untracked files (the file you just made)
git statusIt should show the new file you just created.
Track the file you just made.
git add .Ensures the job was done.
git status5. Commit your changes
Run the commit command and add a short description of this commit.
git commit –m “your_name.md”6. Push your changes to the remote repository CODE-class
Push changes to a new branch on the remote repository:
git push origin my-branchYou should now see your own branch listed after running:
git branchResults should show the following:
main
*my-branchNote: Star next to branch is the currently active branch.
7. Merge your branch into main
(Should this be moved up?)
To merge locally, you must be on the main branch
Switch to the target branch*
git checkout mainPull the latest changes from the remote to ensure you're up to date
git pull origin mainMerge the source branch into 'main'
git merge my-branch
**Push your changes to main
git push origin main