Git FAQ

From HaFrWiki
Jump to: navigation, search

Rollback to an old Git commit

How to get a previous version of the Git repository.

$ git checkout <revision>

The revision number is the number of the previous version.
To obtain these numbers use:

$ git log
commit 8bad69f3c3c37725ee0cb0cfa34fe6a2f5298272
Author: Harm Frielink <harm@harmfrielink.nl>
Date:   Wed Jul 12 19:34:21 2017 +0200

    Additions

commit d642082afa0aadbff5c926179ab040d2177358cf
Author: Harm Frielink <harm@harmfrielink.nl>
Date:   Fri May 22 11:22:48 2015 +0200

    Added Observer Observable pattern

The numbers behind the commit are revision numbers.

Make an alias for this one:

$ $ git log --pretty=oneline
8bad69f3c3c37725ee0cb0cfa34fe6a2f5298272 Additions
d642082afa0aadbff5c926179ab040d2177358cf Added Observer Observable pattern
22f19e16115bc767f843d71f876cb62869252a5e Adding the mediator demo
e475895ef55994fd82a845fbfd0560635436e2fc More version info
f3bbfb4a812431b8f020f913745bf45943e7238b better build.xml
694b3b197c4bfda990333e36d9bc61c110c0d068 Even more ignores and some java build files
d346c0755f95982154a0815e7e7f6e6e6cb2b363 Updating the git ignore with more ignores
28e63d56ee0f1ba4b2a58ffa0ffc727c0f49c50b no message
0f35605fa1a62137b806490d60ace090099fb2ba no message
0832a71c1c4ab199fbd105619a649e2e3f20f546 Merge branch 'master' of https://repohafr.git.cloudforge.com/gitrepotest
5db63c6dcf02e614637ff5f5403620d6e3700950 Daily update
7b78e2b7080ed5dadcd86b870f7f8dffa0bb635d Daily update
881c0273c6f6025d4ddecf1283ad3c96c1119d72 Merging and commiting the files
2502cdcbc0fff8afde31743391aac777e2465f73 Merge all
34d4df1238c874ae5556ad4c49246e9c9b12ffe5 Some cosmectic changes.
aa67d8415e2fb989bed749e5331c65e092aeddfe Daily Update
57087586557eb10972793ad9e0f30d4e5f89fc09 Daily update
177ce4a643ea6141cf692362739e6a8aa69d2cb1 Daily update
596a6f47f36081c12d568792fd86e87886a669a2 Daily update
cf23a2b418a5b79482334d5fbabc24147a77212d More ignore files
fff2acaec2fcaa196077ec2e1893f4f2732c34c8 Adding Ignore fields
3c31e4c4edfb238fc19cd709e2fbe0c7e3655c26 Introduction

Git Push Error

Question header Git Push Error: insufficient permission for adding an object to repository database. [1]
Original question
When I try to push to a shared git remote, I get the following error: insufficient permission for adding an object to repository database
Then I read about a fix here: Fix This worked for the next push, since all of the files were of the correct group, but the next time someone pushed up a change it made a new item in the objects folder that had their default group as the group. The only thing I can think of is to change all of the developer's default group for items they check in, but that seems like a hack. Any ideas? Thanks.

Working Answer
Use the following command, works like magic:

$ sudo chown -R "${USER:-$(id -un)}" .

Type the command exactly as it is (with extra spaces and one dot at the end, but without the starting dollar sign = prompt)

See also

top

Reference

top

  1. Stackoverflow, Git Push Error Insufficient Permission for adding an object to repo.