1. Git - Version Control with GitHub and Git
Controlling file versions and projects.
Committing Process:
Modifying (modify files) -> Staging (picking which modified file to commit) -> Committing
- push to make changes from local to server
- pull to make changes from server to local
How to start:
In terminal:
- git init // initializes a git folder
- git status // shows the status of project
- git add <filename> // adds a file to the staging process
- git add . // stages all modified files
- git commit -m "STRING MESSAGE"
- git checkout -- <filename> // retrieve file from git repo
- git remote add origin <githubRepoLink> // link origin branch to the github repo
- need setup before using "git push" shortcut
- git push --set-upstream origin master
- git push origin master // pushes the origin(localname) to the master branch in github
Pulling:
- git pull origin master // pulls the master branch
Branches:
- master branch // the main branch that contains original code and their evolution.
- git checkout -b NEWBRANCHNAME // creates a new branch from the master branch
- git branch // shows branches
- git push origin NEWBRANCHNAME // pushes the new branch onto github.
- can merge branches to master using pull requests.
Others:
- git log // shows all commit logs and hash checkpoints.
- git checkout [hash] // restore chosen commit and branch off from master branch.
Comments
Post a Comment