Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I recently started hosting my repos on my own server and found this handy way of looking at all the files from the repo without cloning (assuming you used the -bare option which doesn't show the files but has other benefits).
- git log --pretty=format: --name-only --diff-filter=A | sort -
- that's on the actual server, but you could call it from your local machine by ssh'ing to the server by:
- ssh user@host "your git command here"
- TO View Log:
- git log
- git log --name-status or git log --name-only or git log --stat
- If you want to get the file names only without the rest of the commit message you can use:
- git log --name-only --pretty=format: <branch name>
- This can then be extended to use the various options that contain the file name:
- git log --name-status --pretty=format: <branch name>
- git log --stat --pretty=format: <branch name>
- git diff --stat HEAD^! shows changed files and added/removed line counts for the last commit (HEAD).
- Show revision Number:
- git rev-list HEAD | wc -l
- Ignore a file from tracking:
- git update-index --assume-unchanged <file>
- To remove a file that you have added but not committed, use a command like this:
- git rm --cached file.to.remove
- This will remove the file from the index, but not touch the file on disk.
- To remove a file (or files) from the most recent commit, use the above git rm --cached command followed by git commit --amend.
- git reset --hard <commit-hash>
- git rm -r --cached .
- git add .
- git commit -m "fixed untracked files"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement