Reputation: 361
This is what I'm doing:
git init // initialize repository
git add foo.bar // adds foo.bar to the repository
git commit -m "commit message" // commits the added files
git status // status of repository
git log // commit log
How to revert files to a specific commit without affecting repository? Simple use case scenario: you want to test how the program works with an older revision but keeping in the repo the later commits.
Commits id is a sha key? no number like svn?
Upvotes: 0
Views: 636
Reputation: 26555
git commit
to add new commits.git log
to list all commits (this will also show the SHA1 id of the commits)git reset --hard <SHA1>
to reset your branch to a given SHA1 idgit checkout <SHA1>
to view an older commit without changing your branches.Git has a great help. For example you can use git help reset
for details about git reset
.
Use gitk --all
or git log --graph --decorate --all
for a good overview over the current situation.
Upvotes: 1
Reputation: 7305
You can reset the last commit through: git reset HEAD~1
.
Yes, git uses SHA1 hashes for commit IDs.
Upvotes: 1