-
Notifications
You must be signed in to change notification settings - Fork 0
Git Basics
Alex Thomas edited this page Sep 7, 2023
·
14 revisions
-
git clone https://github.com/ucsbdeepspace/trippmake a local copy of the pipeline -
git pull(from inside pipeline dir): sync local copy with remote copy -
git add </path/to/file>add changes in file to current commit-tracked changes -
git commitcommit all tracked changes as one "unit" of work -
git pushsync local commits with remote host
-
git branchlist all branches -
git checkout -b <new name>make and switch local to a new branch -
git merge <branch>merge into current branch -
git checkout <branch>switch local directory to -
git push --set-upstream origin <branch>Creates your local branch in the remote repository -
git checkout --track <branch_name>Switches to remote branch not on local machine
-
git logprint list of commits with hashes -
git checkout <hash>go back in time and switch to a particular hash -
git statusCheck which files have been changed on this branch since the last commit -
git diff <filename>look at the changes you've made since the last commit -
git stash/git stash saveput your uncommitted/unstaged changes away in a git provided stash so that you can switch to working on something else -
git stash applyto apply the changes you stashed. Works in any local branch, no matter where you saved the changes. -
git checkout -- <filename>to delete ALL of the changes on your branch since the last commit. You can make pull requests for branches on the github app.
Sometimes, when merging, pulling, pushing, or doing any version control, GitHub will not like you committing after applying changes. Here we have an example:
<<<<<<< HEAD
<link type="text/css" rel="stylesheet" media="all" href="style.css" />
=======
<!-- no style -->
>>>>>>> master
The <<< indicates the parts of the original file that are in conflict
The >>> indicates the changes you made that are in conflict with the original file
The == separates the two
To fix this, you will have to manually edit the file so that your changes are included and work. Remove the <<<, ==, and >>> lines after you are done. Then the commit will work.