push
- Usage:
java gitlet.Main push [remote name] [remote branch name]
Description: Attempts to append the current branch's commits to the end of the given branch at the given remote. Details:
This command only works if the remote branch's head is in the history of the current local head, which means that the local branch contains some commits in the future of the remote branch. In this case, append the future commits to the remote branch. Then, the remote should reset to the front of the appended commits (so its head will be the same as the local head). This is called fast-forwarding.
If the Gitlet system on the remote machine exists but does not have the input branch, then simply add the branch to the remote Gitlet.
- Failure cases: If the remote branch's head is not in the history
of the current local head, print the error message
Please pull down remote changes before pushing.
If the remote.gitlet
directory does not exist, printRemote directory not found.
- Dangerous?: No.