Crash Course in Git¶
Getting the code¶
For an anonymous checkout of our repository, use the following command:git clone git://rpinventory.com/rpinventory.git
If you have commit access, you will be given the correct command to use when receiving access.
Updating to the latest version¶
To update your local repository with changes by other project members, usegit pull origin
Making changes¶
Work on any changes you wish to do locally. If you create a new file, add it to be tracked by git withgit add [filename]
View changes before committing (optional)¶
To see exactly what will change before making a commit, usegit diff
This will show you a diff of all changes since the last commit.
Committing changes locally¶
When you are ready to commit your changes, issuegit commit -aThis will automatically add any modified files to your commit. Alternatively, you can specify individual files you wish to commit:
git commit [filename]
In either case, your default editor will open, allowing you to write a commit message. You will also be shown the files that will change during this commit. "Save" the commit message using your editor's save command. This will then create a local commit.
Pushing changes to server¶
Continue working and committing locally until you are ready to have your changes accessible to other project members. To push any new local commits to the central repository, usegit push origin master
This will take all commits from your master branch and push them to the remote (origin) branch. While attempting to do this, you may find that the server rejects you. This most likely means someone else has pushed changes to the central repository since you last pulled changes. This means you will need to pull the latest changes before pushing your own.
git pull origin git push origin master