git & github
Make changes to file in text editor. Add changes via bash/command line. Commit changes to git. Continuous integration, adding code into master on a continual basis to eliminate massive changes. Fetch (pull) before you work. Fetch before you push! Fetch often! Then merge!
- Use
cd ~to go to root - Use
cd /c/...to arrive at files - Use
mvand then file name to move files - Use
git initto track a project in whatever directory - Use
git add .(or add file name) to add an entire project to track - Use
git add -Afor adding anything and everything like magic - Use
git commit -m "message goes here"to commit the add files - Use
git logto see a log of file changes and commit - Use
git statusto see what files are not commited - Use
git diffto see changes to files that are in the working files - Use
git diff --stagedto see changes in the add stage - Use
git rm <file>to remove file followed by git commit to remove the file into the staging area then to the trash. (File is saved in repository) - Use
git checkoutto change modified files back to the repository change (usegit checkout -- <file>to just change one file) - Use
git reset HEAD <file>to take a file off the add and back to working file - Use
git commit --amend -m "message here"to amend a commit - Use
git revert(first ten digits of sha #) to revert a commit change on a particular file. - Use
git add remoteto add a remote repository - Use
git remote set-url origin https://github.com/USERNAME/OTHERREPOSITORY.gitto set a remote origin - Use
git helpfor help directory
Git Workflow for Collaboration:
git checkout mastergit clone- git clone https://github.com/USERNAME/REPOSITORY.git
Clones a repository to your computer
git fetch- git fetch remotename
Fetches updates made to a remote repository
git merge origin/master- git merge remotename/branchname
Merges updates made online with your local work
git checkout -b(new branch for day's work)git add dayswork.htmlgit commit -m "Added a new page"git fetch(make sure Im up to date)git push -u origin new_branchgit pullis a convenient shortcut for completing both git fetch and git merge in the same command- git pull remotename branchname
Grabs online updates and merges them with your local work