Page History
...
To push your commits on the command line, enter git push
.
Getting Earlier Versions of Files
If you want to revert all your local changes and get back to the previous repository state, use git reset --hard
or the Reset item in the EGit context menu. If you only want to revert some specific files, do one of the following:
- Right click the files, click Replace With, click HEAD Revision.
- Enter
git checkout <path>
on the command line.
By giving a branch, tag, or commit number in git checkout <commit> <path>, you can get to any existing version of the files. If no path is given, git checkout <commit> switches your whole working copy and index to the specified branch, tag, or commit number. If git reset is given a commit number, the current branch is modified to point at the given commit.
Warning |
---|
This is a brute force modification, and you probably won't be able to push the new branch |
Cleaning Your Working Directory
In case the working directory is messed up with unstaged files, which are not affected by git reset --hard, a clean up is achieved by means of git clean -f. The additional switch -d applies this to directories, respectively. Hence, git reset + git clean act like svn revert.
git clean -X removes only the files that are ignored by Git, that is mainly the .class files generated by the Java compiler. A full rebuild is required afterwards.
Branching and Merging