Working with Github and Android Studio
This is a Draft version. This message will be removed once the section has been completed.
Working with GitHub
First register on GitHub using the following link : https://education.github.com/pack
When registering using the link above use your Seneca Email. This will give you 5 private repository and other extra features.
Setting up repository
To create a new repository, on the website click on the button "+New repository". A form will appear and fill out the following:
- Repository Name
- Optional: Enter a description for your project.
- Choose whether you want your repository to be public or private.
- Public : Anyone can see the repository including the code.
- Private : You're the only one who can see inside the repository.
- Add a ".gitignore" file to your repository. For Android you'll be using the Android gitignore, this can be searched in the drop down menu.
Once the repository can be created. The repository will contain the gitignore file and a README file.
Optional: You can edit the README file, to write a small description and specification of your project, so that other developers can understand the application. (If you did not filled out the description text box when filling out the form)
The following link explains how to create a repository in detail : https://help.github.com/articles/create-a-repo/
GitHub Commands
GitHub was designed to handle Linux like project. Hence making this a command line system (There is an UI system as well which will be discussed later) Download the following UI application for GitHub from the following website:https://windows.github.com/
Once installed open the application. On the left-hand side click on the options and change "Default Shell" to "Git Bash".
To open Git Bash simply find the Git Shell application on you PC. once you have installed the GitHub UI.
Here are some of the important commands for GitHub using Git Bash :
- git init - Initializes a new Git repository.
- git config -(configure) when setting up git for the first time.
- git help - Displays the commands and what they do.
- git status - Checks the status of your repository. Checks whats needs to be committed and what branch you are working on currently.
- git add - Brings the files to git's attention. (It stages the files)
- git commit - Once finalized the changes that have been made to the file/s. git commit will update the files that were changed or added.
- The command for git commit is : git commit -m "message". The "message" is always required when committing a file to GitHub.
- git branch - Allows you to add a new branch to work on.
- git checkout - Allows you to check if the branches and Master are up to date.
- git merge - Merges the current branch with master. BE CAREFUL WHEN DOING THIS! It is not as smart as you may think.
- git push - Pushes files from your local computer to GitHub online so the changes can be viewed.
- git pull - Pulls the latest file from GitHub online to your local computer.