Showing posts with label Git. Show all posts
Showing posts with label Git. Show all posts

11 March, 2018

How can I edit / fix the last git commit's message?

How can I edit / fix the last git commit's message?

Amending any message to your git or bit-bucket is quite easy. Normally sometime, a developer need to modify the last committed message in git/bit-bucket. Git command is providing easy commands to achieve this. Follow the below steps with attached screen shot and you can do this.

Just pull your working branch , where  you want to modify the last commit. But, make sure you want to modify your last commit for the working branch.I have bit-bucket in this example post.

Command Syntax:-


git commit --amend -m "Your Amend Message"
Then use the below command to push your changes.
git push -f  origin master

Example , as per the attached screenshot. I have used the command prompt for this example. In the below example , I have updated the new message "Amending new message". Then, push  (used -means --force) the message to git/bit-bucket. Use the below screenshot as reference. 


bit-bucket command - Java Developers Guide
Bit-Bucket amend


Now, you can see in bit-bucket the last committed message. The last message I have modified , its reflecting.


bit bucket amend
Bit-Bucket web view


Hope it will help you.



Follow for more details on Google+ and @Facebook!!!

Find More :-

13 September, 2016

How to configure the username on git

How to configure the user name on git.

 

This is simple solution but BIG question .....???

To change/configure the user name at your local machine is very easy, but the user name issue is often trouble to developer.

Usually you will get the below error :-

remote: refs/heads/bugfix/testtagging: bd04a65ec413cecbd11cadc336cb4dd25fa3d935: expected committer name 'Manoj Kumar Bardhan' but found 'manojkumar.bardhan'

To fix this , you need to configure the user name as expected. First check what is the existing user name before set to new.

dev@jdg-developer-desktop ~/testtagging/test $ git config --global user.name
manojkumar.bardhan


Change/Configure the user name by using below command, you can provide your expected user name.


dev@jdg-developer-desktop ~/testtagging/test $ git config --global user.name "Manoj Kumar Bardhan"

Now, you can check again the user name after change/configure.

dev@jdg-developer-desktop ~/testtagging/test $ git config --global user.name
Manoj Kumar Bardhan


Now you can see the old user name was "manojkumar.bardhan" and new user name is "Manoj Kumar Bardhan".


It worked for me, hope it will help you.




Follow for more details on Google+ and @Facebook!!!

Find More :-

How to create tag on github

How to create tagging on git.



Really creating tag is  one of the best practice for development and maintain version. 


As per my understanding production release for your code is a nightmare , we don't know what will happen ???????

Also to maintain the code base stable and safety we need this tagging. This is quite often developers do goooooogle for tagging the their code (branch / master) for safety and reference future use.

This is quite simple , and below example will help you to understand the commands on command line.

Clone your code branch (use clone command to clone the code)

git clone https://your.user.name@stash.jdgnet.com.au/scm/enabler/testcode.git

Switch your expected branch (i.e.  bugfix/jdctagging) , which you want to create tagging and make sure you are inside the expected branch.

dev@jdg-developer-desktop ~/jdgtaggingdemo/test $ git checkout bugfix/jdctagging
Branch bugfix/testing set up to track remote branch bugfix/jdctagging from origin.
Switched to a new branch 'bugfix/jdctagging'
dev@jdg-developer-desktop ~/jdgtaggingdemo/test $ git branch
* bugfix/jdctagging
  master


Create the tag with below command, you can specify the tag version name.

dev@jdg-developer-desktop ~/jdgtaggingdemo/test $ git tag -a "v1.taging.version1" -m "commiting with for test tagging for my branch code"

Check the tag got created on above command.

dev@jdg-developer-desktop ~/jdgtaggingdemo/test $ git tag
v1.taging.version1

Push the newly created tag into remote server (stash)

dev@jdg-developer-desktop ~/jdgtaggingdemo/test $ git push origin v1.taging.version1
Password for 'https://your.user.name@stash.jdgnet.com.au':
To https://your.user.name@stash.jdgnet.com.au/scm/enabler/test.git
 * [new tag]         v1.taging.version1 -> v1.taging.version1

If you don't want to push the tag by name and you want to push all tags then use below command. In my example I have only created one tag and I didn't use the below command.


git push origin --tags


Now you can see the [new tag] got created on remote server. See the snapshot below , showing the tag on stash.






Hope it will help you.





Follow for more details on Google+ and @Facebook!!!

Find More :-

17 December, 2014

Detecting the current branch failed: fatal: ref HEAD is not a symbolic ref



This issue occurs when I tried with Jenkins build using Maven Release Plugin. I was trying to build my production release artifacts. I was building my "master" branch and its for final release. I have used Git as repository. I faced this issue when clicked on "maven release build" link on left side corner of my Maven project (Jenkins job) .


As we know build issue is common for developers those are actively participating with Build and Release. This issue over Jenkins is common , but I never found any direct or easy solution for this. I spend couple of hour to resolve and goooogle almost all relavant sites and article.But, not able to work out. Finally did it by some HIT and TRY ,then it works for me.   


Issue log details :-

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 23.884s
[INFO] Finished at: Wed Dec 17 18:05:43 EST 2014
[INFO] Final Memory: 15M/301M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.0:prepare (default-cli) on project hello_world_app: An error is occurred in the checkin process: Exception while executing SCM command. Detecting the current branch failed: fatal: ref HEAD is not a symbolic ref -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[JENKINS] Archiving /opt/jenkins_dev/workspace/SDP_BIZ_HELLO_WORLD_APP/pom.xml to in.com.company.xcop.sdp.bizservice.test.dao/hello_world_app/0.0.8-SNAPSHOT/ hello_world_app -0.0.8-SNAPSHOT.pom
channel stopped
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds



Solution :-

 In Jenkins job , open the configuration and go to Git configuration => Advance Options => << add your local branch name >>. In my case I have added "master" .

If you are using some other version of jerkins then , you may find the similar settings with other way. In the same way Git configuration => Advance Options => Additional Behaviors => Check out to specific local branch => << Add your local branch name >>.   

Attached the screenshot below with highlight. 







Hope it will help you. Happy Building.

10 September, 2014

Git plugin installation on Eclipse

Git plugin installation on Eclipse.

This is very easy and you can do this easily. Normally , Eclipse IDE comes with in-build git plug-in. But, some how if its missed, we can add as the external plugin. Follow the below step-by-step process .

Step by step process to install git  plugin on eclipse:-

Step 1) Use the repository location. i.e. http://download.eclipse.org/egit/updates

Step 2.) Go to Help > Install New Software

Step 3.) Add repository location, Click Add. Enter repository name as "EGit".Then click Ok to add repository location.

Step 4.) Expand “Eclipse Git Team Provider” and select “Eclipse Git Team Provider”. Then Click Next

Step 5.) Review product and click Next.

Step 6.) Accept the agreement and click Finish.

Step 7.) Then, it will take few time for download the plugin and binaries.

Step 8.) Then ,accept the prompt to restart the Eclipse.

Now Your Eclipse is ready to use Git Repository Plugin.

You can also verify the Git installation.

Step 1.) Go to Help > Install New Software

Step 2.) Click on Already Installed and verify plugin is installed.

Else you can verify by searching on Windows => preference => type egit on search box.



Screenshot 1:-






Screenshot 2:-








Hope it will help you.





Follow for more details on Google+ and @Facebook!!!

Find More :-