2. Github - Version Control with Git
Committing Process:
Modifying (modify files) -> Staging (picking which modified file to commit) -> Committing
1. Create repository in Github.
2. In Directory of code project, git init
// creates a hidden folder to track changes.
3. Adding files to the staging process (process that is before committing).
Use "git add <FILENAME>"
OR
"git add ."
4. Committing files, updating version control stuff,
Use git commit -m "MESSAGE"
// -m, is attaching a message.
5. Pushing to Github
- Use code provided by GitHub to remote add local directory to GitHub repository.
- Use push code to push to GitHub repository
- 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
6. Updating future changes and pushing,
- git status // checks status of files if it matches what is in GitHub/Git logs
- git add // adds changes to the staging process
- git commit -m "MESSAGE // committing changes to version control
- git push // pushes changes to GitHub, dont have to set anything, just git push
Restoring files from GitHub
git restore <FILENAME>
Comments
Post a Comment