Difference between revisions of "GIT"

From PrattWiki
Jump to navigation Jump to search
Line 28: Line 28:
 
=== Git Push ===
 
=== Git Push ===
 
The command ''git push'' sends any commits that have been completed since the last push to the git server.  If there have been any changes to the git files by another user, there will be a prompt to first perform a ''git pull'' before pushing the changes to the git server.
 
The command ''git push'' sends any commits that have been completed since the last push to the git server.  If there have been any changes to the git files by another user, there will be a prompt to first perform a ''git pull'' before pushing the changes to the git server.
 +
 +
=== Git Pull ===
 +
The command ''git pull'' pulls any commits that have been pushed to the server by another user.  If any files have been edited, both locally and by another user since the last git pull, you will be prompted to merge the two files together.  Once the files are merged a normal git push can be done if the file is edited again.
  
 
== Branching ==
 
== Branching ==

Revision as of 21:39, 10 June 2015

Git is a server based file system that allows group access and collaboration to a set of files. Git takes snapshots of every edit that is committed to the system. This gives the user flexibility to make large changes to the code without losing the previously written code. A majority of Git operations are all performed locally, allowing for files to be saved and edited without an internet connection and pushed to the server when an internet connection is available.

Still under Development

This page is still under development for the Fall 2015 semester.

Important Commands

The Basics

Before editing files it is important to perform a git pull. This ensures that there are no conflicts between your local files and any files on the git server.

It is good practice to use the following commands after you finish editing your files and exit from the linux environment:

git add .
git commit -a -m 'end of day'
git push

This ensures that all files have been saved and committed to the git server, and that a snapshot of that days work is saved.

Git Add

The command git add . notifies the git server that any new files in the local directory are to be added to the git server. Any time a new file is created this command must be run for git to create a snapshot of the file and allow any nonlocal changes to be pulled.

Git Commit

The command git commit -a -m 'String' commits marks any changes you have made as a snapshot. This does not cause any changes to the git server until the push command is used.

Git Push

The command git push sends any commits that have been completed since the last push to the git server. If there have been any changes to the git files by another user, there will be a prompt to first perform a git pull before pushing the changes to the git server.

Git Pull

The command git pull pulls any commits that have been pushed to the server by another user. If any files have been edited, both locally and by another user since the last git pull, you will be prompted to merge the two files together. Once the files are merged a normal git push can be done if the file is edited again.

Branching

Common Errors