This is just a simple Project to help FTC Teams to see how git works, including a few exercices
In this exercise we will do the following:
You have to create a your own git
Account
Visit the link for simple examples and how to setup your git [https://rogerdudler.github.io/git-guide/]
Also Learn git in 10 minutes: [https://www.freecodecamp.org/news/learn-the-basics-of-git-in-under-10-minutes-da548267cc91/]
- Clone the Project
- Make some changes, commit and push the Changes.
- Install a
git
client - On your PC create a directory where you want to clone the Project
- Run the following command (Assuming you use a simple git terminal type Client)
git clone https://github.com/mtbbiker/git_practise.git
- If you make changes and you would like
push
your changes to the original project, you will have to request aPull Request
more on that later
This you can do on the github
web page. This will create a copy
of the project in your namespace
- Search for the
repository
that you want to fork if you don't own the repository - Click on the
Fork
button (to the Top of the web page, next to theUnwatch
andStar
button)
Branching is normaly used for maintaining and Testing code, then once it passes all test it will be merge back to the Master. The master will then typicaly used for Releases.
Click
on theBranch:master
button. Use the Find or create a new branch- On your PC you will have to pull the Branch.
git pull
And a Typical Result:
$ * [new branch] development -> origin/development
-
To change to this new Branch for further work execute the following command:
git checkout -b development
-
Change some code.
-
View the status of your changes:
git status
eugene@atlanta:~/Private/FTC/git_practise$ git status
On branch development
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: README.md
no changes added to commit (use "git add" and/or "git commit -a")
- Add your change
git add README.md
- Commit your code: ```git commit -m 'My new change'
- Push your changes:
git push
If you have not set the Upstream you will get a message like
eugene@atlanta:~/Private/FTC/git_practise$ git push
fatal: The current branch development has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin development
- Set the upstream Branch:
git push --set-upstream origin development
, Then push again
First set your Branch to Track the Remote Changes
- Set the Branch :
git branch --set-upstream-to=origin/development
- Pull code
git pull
- Push Your changes
git push
- Make a change, add, commit and Push
Create a Pull Request to Merge your changes.
- Click on the
Create a Pull Request
- You have the Option to now Delete your Branch. It is recommended to keep if development are not completed yet.
Pull all The changes so that the latest version of your code is kept on your local repo
git pull origin master