Git Github COMMANDS
Git Github COMMANDS
If you already have projects locally, then you need to make those folders git
repository.
$ cd ~/Desktop/app-demo
app-demo - $ ls
$ git status
fatal: not a git repository (or any of the parent directories): .git
OR
$ ls -la
(check for .git hidden file, if you see it in the current directory, then it means
After git init, git will track every change that takes place within
that folder.
Git commands
- Now go to Github and create a new repo
Git commands
Git commands
$ git remote -v
This command will tell whether your local repository is connected to the
remote repo or not.
$ git push -u origin main (first time only, next consecutive pushes,
1. If it is your own github account and repository, you can clone, push and
pull directly to the main branch without any issues
2. If it is someone else’s remote repo, they can add you as a collaborator
to the repo
3. If it is someone else’s remote repo, you can fork the repo and submit
pull request when you would like to merge some code into their repo.
Git commands
1. If it is your own github account and repository, you can clone, push and pull directly to
the main branch without any issues
Git commands
2. If it is someone else’s repository, one way to contribute to the project/repo is to be
added as a collaborator
Example:
- Create a new remote for the upstream repo with the command:
- Check connected remote repos locally again, now you will see one for origin
$ git remote -v
Git commands
- Next, make some changes and push them to the remote origin (your forked remote
repo)
$ cat test.txt
$ git status
$ git push -u origin new_branch (OR $ git push --set-upstream origin newb)
Git commands
- Next, check your github account
Git commands
Git commands
Git commands
- Separate into groups/teams
- Create team project repos in Github
- Introduce with HTML/CSS projects
- Projects are due in 2 weeks
- Work in groups (create local
branches, avoid pushing code to main
branch)
- Collaborate with each other
- Distribute tasks between each other
- Designate a team leader
Questions?