Command that initializes our file directory into a new Git repo
Status / Add & Commit
Status - shows us which files we have changed in our repo, and which files we are currently tracking
Add - add files to the staging area
Which files do we want to include in our next commit?
Commit - saving a snapshot of our recently changed files
Commit often and frequently
Usually want to commit whenever we’ve made an incremental change or improvement to one or more files
Infrequent commits can make it difficult to know where exactly our project broke / what needs to be corrected
Git Push
Rolling Back a Commit
Git Clone
Copying a project and downloading it to your local machine from a remote repo
Forking
Copying a project and creating your own branch, allowing you to hack away without fear of altering repo you forked from
Merging / Pull Requests
Merge - combining separate branches of your project, typically to add a new feature while ensuring you don’t break any existing functionality of your project
Pull Requests - typically a more formal process where you’re asking an assigned person to merge your code into their repo, while explaining the changes you made and why they should be merged
Merge Conflicts - errors that may arise when trying to merge branches - can sometimes be ignored, but should always be carefully looked at to avoid any breaking changes that may arise from merging the two branches
Summarize
Git is our coding time machine. Mistakes and errors in our code are inevitable. Git allows us to roll back to when our code was still working and avoid making the same mistake twice. Git is our coding safety net. It will also allow you in the future to collaborate with others.
请发表评论