Author:
erics , February 7th, 2020
First, get on the branch that you know already has the commits you are looking for:
git checkout theBranch - 1234
Copy-and-paste the commit(s) you want:
~or~
Optionally, display the code changes for a visual confirmation:
git show { one or more commit ID 's }
Finally, extract the list of branches that contain the desired commits:
git branch -- contains CommitID - A
git branch -- contains CommitID - B
Example:
git log
git branch -- contains 097e1859f248a7aa5e148a2a946be3e360030095
git branch -- contains 24339549f9f1920a33f721d3faa2538c8ba5d249
Categories: How-To's , Technology Tags: commit , git , git log , git show , howto , Show , tips
| No comments
Author:
erics , January 30th, 2020
Recently, I wanted to see the “origin” of the git repository I was working in. The command is: git remote -v For example:
theUser @ theHost $ git remote - v
origin git @ localhost : / volumes / data / git / thePlugin . git ( fetch )
origin git @ localhost : / volumes / data / git / thePlugin . git ( push )
Categories: How-To's , Technology Tags: cli , Command , Display , git , git remote , howto , Linux , Show , tips
| No comments
Author:
erics , December 2nd, 2019
Not pushed + most recent commit:
Categories: How-To's , Technology Tags: amend , Change , git , howto , modify , tips
| No comments
Author:
erics , June 3rd, 2019
To display the filenames included in each commit, just add the –name-only argument to git log:
Categories: How-To's , Technology Tags: Display , File , file names , git , git log , howto , Log , names , Show , tips
| No comments
Author:
erics , May 31st, 2019
Quickref: How to Remove a file from the staging area
git rm -- cached { fileName ( s ) }
The Story Recently, I accidentally added some files to git’s pre-commit phase, i.e.:
shell > git status
On branch master
Your branch is up - to - date with 'origin/master' .
Changes to be committed :
( use "git reset HEAD <file>..." to unstage )
new file : good1 . xml
new file : good2 . xml
new file : bad1 . xml
new file : bad2 . xml
modified : good3 . xml
modified : bad3 . xml
For example, here is how to handle the above situation:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
shell > git rm -- cached bad1 . xml bad2 . xml bad3 . xml
shell > git status
On branch master
Your branch is up - to - date with 'origin/master' .
Changes to be committed :
( use "git reset HEAD <file>..." to unstage )
new file : good1 . xml
new file : good2 . xml
modified : good3 . xml
Untracked files :
( use "git add <file>..." to include in what will be committed )
bad1 . xml
bad2 . xml
bad3 . xml
To better understand, here are the phases/states/stages that git uses: Untracked – when a file is first created, git […]
Categories: How-To's , Technology Tags: Cache , commit , committed , git , howto , modified , Remove , staged , staging , tips , untracked
| No comments
Author:
erics , March 18th, 2019
git log { path_and_file }
git checkout { commit_hash } -- { path_and_file }
git checkout 8c7eae3f518bb7fd98eb6e8344270f02065d83ee -- myFile . txt
~or~
git checkout master -- theSubDir / theFile . json
Categories: How-To's , Technology Tags: Checkout , commit , git , recover , Restore , Revert , specific
| No comments
Author:
erics , August 2nd, 2018
git checkout -f
Categories: How-To's , Technology Tags: Branch , Checkout , Discard , git , git branch , git checkout , howto , Revert , tips , Undo
| No comments
Author:
erics , January 31st, 2018
Rename the old branch locally: git branch -m oldBranch newBranch Delete the old branch remotely: git push origin :oldBranch Push up the new branch, and make the local branch track with the new remote branch: git push –set-upstream origin newBranch
Categories: How-To's , Technology Tags: Branch , git , git branch , howto , local , remote , Rename , rename branch , tips
| No comments
Author:
erics , October 19th, 2017
Git does not download all branches unless you tell it to. Until then, they are ‘remote’ branches. Use -r to list remote branches: git branch -r git fetch –all git pull –all If you see this error: fatal: The current branch CT-37 has no upstream branch. Push the current branch and set the remote as […]
Categories: Technology Tags: Branch , fetch , git , howto , local , manage , origin , pull , Push , remote , tips
| No comments
Author:
erics , October 19th, 2017
If you want to revert the file to its state in master: git checkout origin/master [filename]
Categories: How-To's , Technology Tags: git , howto , tips
| No comments