Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
centos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
platyhouse
centos
Commits
ab20fd47
Commit
ab20fd47
authored
Nov 26, 2025
by
platyhouse
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
커밋을 실행하기 위해 사용자의 승인이 필요합니다. 위에서 생성된 커밋 메시지로 진행하시겠습니까?
parent
ef186295
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
518 additions
and
0 deletions
+518
-0
ptyFileMove
ptyFileMove
+455
-0
ptyGitFileHistory
ptyGitFileHistory
+63
-0
No files found.
ptyFileMove
0 → 100755
View file @
ab20fd47
This diff is collapsed.
Click to expand it.
ptyGitFileHistory
0 → 100755
View file @
ab20fd47
#!/bin/bash
# 사용법 체크
if
[
$#
-eq
0
]
;
then
echo
"사용법: ptyGitFileHistory <파일경로>"
echo
"예제: ptyGitFileHistory a.php"
exit
1
fi
FILE_PATH
=
"
$1
"
# 파일이 git에서 추적되는지 확인
if
!
git ls-files
--error-unmatch
"
$FILE_PATH
"
>
/dev/null 2>&1
;
then
echo
"❌ 오류: '
$FILE_PATH
'는 git에서 추적되지 않는 파일입니다."
exit
1
fi
# 파일 이름 추출 (경로 제거)
FILE_NAME
=
$(
basename
"
$FILE_PATH
"
)
# 출력 폴더 생성 (파일명 기반 서브폴더)
BASE_DIR
=
"ptyGitFileHistory_output"
OUTPUT_DIR
=
"
$BASE_DIR
/
$FILE_NAME
"
mkdir
-p
"
$OUTPUT_DIR
"
echo
"📂 '
$FILE_PATH
' 파일의 git 히스토리를 추출합니다..."
echo
""
# git log에서 커밋 해시와 날짜를 가져옴
# 날짜 형식: YYYY-MM-DD-HHMMSS
git log
--follow
--format
=
"%H|%ad"
--date
=
format:
"%Y-%m-%d-%H%M%S"
--
"
$FILE_PATH
"
|
while
IFS
=
'|'
read
-r
COMMIT_HASH COMMIT_DATE
;
do
# 폴더 이름: 날짜-커밋해시
FOLDER_NAME
=
"
${
COMMIT_DATE
}
-
${
COMMIT_HASH
:0:8
}
"
COMMIT_DIR
=
"
$OUTPUT_DIR
/
$FOLDER_NAME
"
# 폴더 생성
mkdir
-p
"
$COMMIT_DIR
"
# 커밋에서 파일 내용 추출
if
git show
"
$COMMIT_HASH
:
$FILE_PATH
"
>
"
$COMMIT_DIR
/
$FILE_NAME
"
2>/dev/null
;
then
echo
"✅
$FOLDER_NAME
"
else
# 파일이 해당 커밋에서 삭제되었거나 없는 경우
echo
"⚠️
$FOLDER_NAME
(파일 없음)"
rm
-rf
"
$COMMIT_DIR
"
fi
done
echo
""
echo
"✅ 완료! 결과는 '
$OUTPUT_DIR
' 폴더에 저장되었습니다."
echo
""
# 생성된 폴더 개수 표시
FOLDER_COUNT
=
$(
find
"
$OUTPUT_DIR
"
-mindepth
1
-maxdepth
1
-type
d |
wc
-l
|
tr
-d
' '
)
echo
"📊 총
$FOLDER_COUNT
개의 버전이 추출되었습니다."
# 폴더 목록 표시
echo
""
echo
"생성된 폴더 목록:"
ls
-1
"
$OUTPUT_DIR
"
|
head
-10
if
[
"
$FOLDER_COUNT
"
-gt
10
]
;
then
echo
"... (나머지
$((
$FOLDER_COUNT
-
10
))
개)"
fi
platyhouse
@platyhouse
mentioned in commit
8587004b
·
Dec 16, 2025
mentioned in commit
8587004b
mentioned in commit 8587004bfbebb2ceff13804bc1eea04727f6a285
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment